Android :: Android 1.5 - Asynctask DoInBackground Not Called / Method Called

Oct 26, 2010

I am running into an issue with the way my asynctasks are executed. Here's the problem code:

firstTask = new background().new FirstTask(context);
if(firstTask.execute().get().toString().equals("1"))
secondTask = new background().new SecondTask(context);

What I'm doing here is creating a new asynctask object, assigning it to firstTask and then executing it. I then want to fire off a separate asynctask when the first one is done and making sure it returns a success value (1 in this case). This works perfectly on Android 2.0 and up. However, I am testing with Android 1.5 and problems start popping up. The code above will run the first asynctask but doInBackground() is never called despite onPreExecute() being called. If I am to execute the first task without the get() method, doInBackground() is called and everything works as expected. Except now I do not have a way to determine if the first task completed successfully so that I can tell the second task to execute. Is it safe to assume that this is a bug with asynctask on Android 1.5? Especially since the API says that the get method has been implemented since API 3. Is there any way to fix this? Or another way to determine that the first task has finished?

Android :: Android 1.5 - Asynctask doInBackground not called / method called


Android :: OnPostExecute Not Called After Completion AsyncTask

Aug 31, 2010

For some reason my onPostExecute() is not called after my AsyncTask finishes.

My class decleration:

CODE:.......

Everything works fine, my doInBackground() completes successfully and returns a Boolean but then it just finishes.

View 2 Replies View Related

Android :: Method Called After Release

Sep 22, 2010

I'm getting this error ( in the end of this post) which I guess I understand it's because I'm calling something after releasing it.. but I can't find a wy to work it around.I've tried all combinations.. I've tried: mCamera.setPreviewCallback(null); This class, where the surfaceview is implemented can be accessed by 2 different classes one that doesnt implement surfaceview and other that does the error just shows me when I go from the activity that uses the camera to the activity that also uses camera.I don't know what else to do.

View 4 Replies View Related

Android :: Is OnUpgrade Method Ever Called?

Jul 2, 2010

Is the onUpgrade method of SQLiteOpenHelper ever called? If so, when is it called and by what? Or if it is not called by developers, then why is it there? What should be done in the method I have seen examples where it drops all the tables, but then a comment says that dropping all the tables is NOT what you should do.

View 1 Replies View Related

Android :: GetView Method Used And Where Is It Getting Called?

Sep 1, 2010

I am new to Android development and have been following the tutorials available on the Android website. I am currently on the section of tutorials for Views, specifically the one for Grid Views: Hello, Grid View Tutorial.I am having trouble understanding how views are made through an adapter. I understand that you must override the getView() method in your adapter class and in this method is where you define how your Views are set up. What I don't understand is where does getView() actually get called? Perhaps I've got the wrong kind of mentality here, but in the code below (the Grid View tutorial) I don't see any calls to getView() (or any other things used in the adapter class such as getCount()).

View 1 Replies View Related

Android :: OnRestart Method Not Called On Restart

Apr 15, 2010

I'm writing a Tetris application on Android for my bachelor thesis at the University of Hasselt. Currently I have a working Tetris base game, but it just keeps on ticking when the activity gets in the background. I'm trying to fix this by overwriting the onStop()and onRestart()methods.when I press my home button on my device I will go to my home screen and onStop() is called. Because the gamemode is now "PAUSE", the game wil not tick anymore. But now, when I longpress my home button and select my tetris activity again, the activity pops up, but it isn't ticking! This is because the onRestart() is never called when I return to play my application.What is the reason that this method is never called? Am I understanding the activity lifecycle wrong?

View 3 Replies View Related

Android :: OnServiceConnected Never Called After BindService Method

Mar 21, 2010

a service started by a broadcast receiver starts an activity. I want to make it possible for this activity to communicate back to the service. I have chosen to use AIDL to make it possible. Everything seems works good except for bindService() method called in onCreate() of the activity. bindService(), in fact, throws a null pointer exception because onServiceConnected() is never called while onBind() method of the service is. Anyway bindService() returns true.The service is obviously active because it starts the activity.I know that calling an activity from a service could sound strange, but unfortunately this is the only way to have speech recognition in a service.

View 4 Replies View Related

Android :: Stopping Method To Be Called Twice If Already Running

Mar 3, 2010

I'm trying to prevent my application to call the same method twice in the event of a double-click, or if the user presses different buttons quickly, almost at the same time.I have clickable Views, acting as buttons, that call the same method but passing different parameters.Inside this method I'm creating a new Thread, because it queries a web server for the result.The problem is that upon two quick clicks, the method is fired twice, two threads are created, and consequently two new activities are created. That makes my app crash.But this only seems to work on slower phones like the G1, I tried on Nexus and before it set blocked = true, the second request has was granted. So is there any way I can block the method being called if it's already running, or if the thread has started so it wont create a new one.

View 3 Replies View Related

Android :: How To Find What Hook / Method Is Being Called In Framework?

Mar 5, 2010

I was wondering how should I proceed to debug while working with frameworks. Like specifically how can i tell which method is being called when a particular event happens.

View 2 Replies View Related

Android :: Calling An InputMethod Method When A BroadcastReceiver Gets Called

Feb 19, 2010

I added a BroadCastReceiver to my application.I want to call my inputMethod's method but I can't find a way to access it's instance.but I couldn't find a way to get the the InputMethod instance from the InputMethodManager.Is doing a singleton the only way to access it?

View 1 Replies View Related

Android :: Extended SurfaceView's OnDraw Method Never Called

Apr 21, 2010

I'm trying to modify the SurfaceView I use for doing a camera preview in order to display an overlaying square. However, the onDraw method of the extended SurfaceView is never called.

View 3 Replies View Related

Android :: Which Method Is Called When Press Back Key On Phone?

Nov 24, 2010

i have an app that haves a lot of activitys, all created with ONACTIVITYRESULT.which method is called when i press back key? i need to know it because i have to override/implement code on it

View 2 Replies View Related

Android :: Is It Normal For OnCreate Method To Be Called Multiple Times?

Aug 27, 2010

I have some code in the onCreate method an Activity and noticed that it is being called three times. Is it normal behaviour?

View 1 Replies View Related

Android :: AsyncTask DoInBackground Does Not Run

Nov 2, 2010

I'm having a problem with the AsyncTask class. It seems like my task stops working after creating 4 or 5 tasks.

Im having 2 activities. MainActivity which only holds a button that starts a second activity called ImageActivity.

ImageActivity is very simple. it got an onCreate that sets the layout, and then it starts a new AsyncTask that loads an image from the internet. This works fine the first few times. But than it suddenly stops working. The onPreExecute method is run every time, but not the doInBackground method. I have tried to simplify the doInBackground with a sleeping loop, and the same thing happens. I cant understand this behavour since the asynctask is both canceled and set to null in the onDestroy method. So every time i start a new ImageActivity, i also create a fresh AsyncTask.

I recreate the ImageActivity and the task by hitting the back button, and than clicking the button on the MainActivity.

UPDATE: Code that starts the ImageActivity (inside a button onClickListener)

CODE:...........

The code above starts this activity

CODE:.............

UPDATE:

I have tested using a combination of traditional Threads and runOnUiThread method, and it seems to work better. Now the thread runs every time.

View 2 Replies View Related

Android :: Voice Recognition Activity Called In OnCreate Method / Causes App To Load Slowly

Oct 1, 2010

In my android app I call the voice recognition in my onCreate method of my startup activity. I have made it a preference to start up with the voice control or not. However, the app takes about 5-7 seconds to load when voice recognition is on. When it is off, the app starts almost instantly. Below is sample code, I have added Free_Form, max_results 1, and a custom prompt to mine.Why would calling the normal android speech recognition take sooo long to load in my OnCreate method?

View 1 Replies View Related

Android :: How To Called Mp3 Download?

Jun 4, 2010

I was reading through app suggestions and someone mentioned an app called mp3 Download that basically functions like limewire, letting you search and download mp3's to your phone. Does anyone know anything about this app and whether it is good or not? Or have suggestions for a similiar app? It had mixed reviews at appbrain and when I searched here it came up with a bunch of other threads.

View 4 Replies View Related

Android :: An App Called Listen?

Sep 22, 2010

I was told by a few friends that the iphone has an app that allows you to hold your phone up to a song that you dont know and it tells you the name.Does android have anything like that?

View 6 Replies View Related

Android :: OnKeyDown Not Always Called In App

Oct 20, 2009

I've created a simple android game, based on the Lunar Lander sample, and I'm having a problem with handling key events.When the activity starts, the only keys that onKeyDown or onKeyUp get called for are the dpad up/down/left/right keys.Neither the menu, back, or dpad_center keys trigger onKey methods. However, once I've pushed one of the dpad up/down/left/right buttons, pressing the menu, back, or dpad_center keys do trigger these methods. I'm not getting any errors, or any indication of what's going wrong.It's possible that the focus is set wrong - the activity is started from a button on screen, so it could be in touchscreen mode. If that's the case, shouldn't touching the back button get me in to the right focus mode so that I can catch the event?I'm using the emulator from SDK-1.5r3.I have not been able to try this on a real phone yet.

View 4 Replies View Related

Android :: Whats That App Called?

Aug 27, 2010

I saw it on the market but forgot to install it. It displays the number of remaining minutes, texts and data left for the month if your on a monthly mobile phone plan.

View 2 Replies View Related

Android :: OnLowMemory Not Getting Called

Apr 6, 2010

I'm working on an application which allocates lot of memory and hence I'm bound to get OutOfMemory. I want a way to get notified when system is running short of memory so that I can stop processing further, notify user and release as much memory as possible.

According to official Android documentation there is a callback onLowMemory from the system. I have a class which extends android.app.Application and I have overridden onLowMemory() method. This class has entry in the in the application tag of AndroidManifest. However it never gets called in my case. Do I need to register for this event using AndroidManifest or any other means?

View 9 Replies View Related

Android :: OnContextMenuClosed() Not Called Under 2.x

Jan 1, 2010

In one of my applications I programmatically open the context menu when something is clicked in my MapActivity overlay. This works perfectly under 1.x as well as on my 2.0 Milestone. I've used showContextMenuForChild() historically, but openContextMenu() does that same thing.

As expected onCreateContextMenu() is called to build the menu and then onContextItemSelected() is called when something is selected. So far all is well.

The odd thing is that under 1.x the onContextMenuClosed() method is called when I press the back key, but not so under 2.0. This confuses states for my app since I need to know whether menu is shown or not - or maybe there is a way to know this that I have not (yet) figured out...

Is this a deliberate change or should I file it as a bug? Googling comes up pretty dry (stuff that is over a year old).

Anyone with a 2.0.1 Droid that would care to test whether this has already been fixed? (The ETA for Milestone 2.0.1 seems hazy still, but it appears that at least one of my reported bugs has been fixed in 2.0.1 event though it isn't flagged as such.)

View 4 Replies View Related

Android :: OnSurfaceCreated Called Twice

Oct 27, 2010

Is there a way to make sure onSurfaceCreated is called only once during startup.

Currently in my app it gets called once with say 800x480 then it gets called a second time with 480x800. I guess this is probably due to a call to setRequestedOrientation in onCreate. Is there any way to make sure the app starts in a particular orientation, to prevent orientation changes, and to have onSurfaceCreated get called only once during start up?

View 3 Replies View Related

Android :: When Does OnFocusChanged Get Called

Mar 3, 2009

I have over-loaded the onFocusChanged() in my classes which inherits from LinearLayout.

CODE:...........................

View 4 Replies View Related

Android :: UncaughtExceptionHandler Not Called?

Apr 16, 2010

i use a ScheduledThreadPoolExecutor combined with a ThreadFactory, their all combined should cause an unchaught Exception to be logged so that i can see what happening if any thread is dying in the ThreadPool:

threadPool = new ScheduledThreadPoolExecutor(poolSize, new ThreadFactory());

My ThreadFactory, also sets a UncaughtExceptionHandler :

public Thread newThread(final Runnable r) { final Thread thread = new Thread(r); thread.setUncaughtExceptionHandler(new ThreadLogger()); final int counter = count.getAndIncrement(); final String name = threadName + counter; thread.setName(threadName + counter); if (Logging.isLoggingEnabled()) { Log.d(LOG_TAG, "Thread created :" + name); } return thread; }

The ThreadLogger :................

View 2 Replies View Related

Android :: OnLocationChanged Does Not Get Called?

Mar 7, 2009

I have been struggling to get onLocationChanged called, but I'm not sure it does not. Here're my code

criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_LOW); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setSpeedRequired(false); criteria.setCostAllowed(true);

String locationContext = Context.LOCATION_SERVICE; locationManager = (LocationManager)context.getSystemService (locationContext);

String provider = locationManager.getBestProvider(criteria, true);.................

View 2 Replies View Related

Android :: OnSaveInstanceState() Normally Not Called?

Jul 5, 2009

Am I right to assume that onSaveInstanceState() is not normally called (which my logging indicates) - but only when the system is forced to kill an Activity. If so, since onPause() does not receive a bundle, what is the best way to save state that should be restored the next time the Activity is created?

View 8 Replies View Related

Android :: 1.6 - OnActivityResult Is Not Called

Jul 6, 2010

I have a problem with the method "onActivityResult".

I create a new Activity from my main activity:

CODE:.........

The new Activity is ended like this:

CODE:.............

But the Method onActivityResult seem to be not called

CODE:................

View 1 Replies View Related

Android :: OnTouch Not Called?

Aug 4, 2010

I'm trying to start activity by sweeping across the screen, it works fine for all the other screens, just this screen that doesn't fire the onTouch at all? Would you mind helping me? I've tried debugging it and still have no idea at all. Below are the codes, sorry for not putting snippets only as I thought I might did something wrong elsewhere

I'm also looking for advice on implementing sweeping to change screen. I've read about ViewFlipper and I know it will work very well, but I've around 8 screens with different backend coding needed.

CODE:.....................

View 1 Replies View Related

Android :: Why OnKeyListener() Not Called

Sep 12, 2010

I defined an EditText-field and I want to be informed when the user edits that fields.
So I thought: simple - I add an OnKeyListener and so I did. But even though the text field gets edited (and even displays the entered/modified text) I don't get any callback, i.e. the LOG-output doesn't show up.

CODE:......

why that callback is never called?

Android is really full of oddities! It seems that almost nothing I touched so far worked immediatly as one would expect. And - believe it or not - I have LOTS of experience with GUIs, esp. in Java (AWT, Swing, SWT, you name it...) But Android is a really tough beast!

View 2 Replies View Related

Android :: How Can GetContentResolver() Be Called

Sep 20, 2010

I want to know the context in which getContentResolver() is called ?

I have a scenario like this : I have an activity A that calls a method myFunc() of class B whcih is not an activity. So, in class B I have to use getContentResolver(). I directly called getContentResolver(). It was showing error. Then I called myFunc(Acitivy act) from the activity and called act.getContentResolver() which solved my problem. My question is is this the only way to call getContentResolver(), which means it can be used in context with activity or can be used alone.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved