Android :: Life Cycle - ListActivity
Aug 18, 2010
When my ListView activity loads it creates the Adapter which fills the screen as it should do. Is there an event or way to find out when the Adapter has finished getting enough data to fill the screen. I want to show a spinner the first time the Activity loads and have it go away once the screen has its first load of data from the Adapter.
View 2 Replies
Nov 12, 2009
The main activity is running, then there is a interrupt. What was happended, onPause(), onStop() or other change of life cycle? 1. pressed the volume_down key and ringer volume toast occured, the life of main activity will not change? why? 2. short press the power key and the OS sleep,how about the activity ? 3. long press the power key and the phone options appear, how? 4. long press the home key and the tast list appear, how? 5. notifications curtain appear, how? 6. press the back key,how?
View 5 Replies
View Related
Mar 7, 2010
When starting a new Activity, I want to pass a complex object and do so by using this approach:
MyActivity.COMPLEX_OBJ = myComplexObj; // which is definitely NOT NULL! Intent intent = new Intent(); intent.setClass(this, MyActivity.class); startActivity(intent);
and then in MyActivity:
@Override public void onCreate(Bundle bundle) { if (COMPLEX_OBJ == null) { // report to Flurry ... } ...
}
View 17 Replies
View Related
Jun 6, 2010
I am having a really hard time grokking the Activity life cycle concept. The main issue is with onStop() and onDestory() not being guaranteed to be called before the process is killed. I though I had it figured out when I saw that the system calls onSaveInstanceState() when it's shutting down the activity to claim some memory. Thing is that the docs says onSaveInstanceState() will be called before onPause() but how does the system know at this point whether the activity will be killed by the system or the user?
Here is a use case:
1) My activity starts up and is running. 2) At some point I want to show a web page so I use an Intent to start an activity. 3) The web browser covers my app/activity so I would expect onPause() to be called followed by onStop(). At this point it's my understanding that all bets are off and I can be killed at any point without be called. 4) Since the system has enough memory onSaveInstance() doesn't get called. 5) The user presses home and decides to open some app which requires a lot of memory. 6) System wants more memory and decides to kill my app but I am already stopped (onPause() has been called).
View 1 Replies
View Related
May 9, 2010
The core of this Widget is an AppWidgetProvider which registers a ContentObserver to the CallLog content URI. This means that my widget is updated every time a call (incoming, outgoing, missed) is recorded. This works fine for a while, until *something happens* and my ContentObserver stops getting called (no error message seen in trace). I would rather that this ContentObserver persisted until the user removes the Widget.
I am guessing that my JVM has been destroyed (due to low memory?), ContentObserver garbage collected and/or ContentObserver unregistered (or just pointing to nothing), but I don't know how to debug this without restarting my code (and thereby re-registering). I can hide this bug by periodically re-registering my Content provider, but I would rather understand the cause and have a more optimal solution..............
View 3 Replies
View Related
Sep 30, 2009
When I start my application I prompt the user for the password and use it to instantiate my data adapter object that I will need throughout the application. So I store it in Application object. My activity A prompts user for pwd, instantiates data adapter, sticks it to Application object and later starts activity B which in turn starts the built int gallery activity. When fooling around with gallery and capturing pictures for some time coming back to activity B I discover that Application.myDataAdapter is null. I found out that during me playing with camera the Application.onTerminate() method was called. So it seems like Android killed my process and when B was supposed to become visible it started a process again jumping directly to activity B bypassing A? Is that how it works? Should I then never assume that Application.myField will survive? and init it not only when A is started but whenever I discover it is null?
View 7 Replies
View Related
Aug 4, 2010
My device is a Nexus One with 2.2 and I have tested two projects, one on 1.5 and one on 2.1. Problem: I have trouble to understand the life cycle of my application when the screen is turned off and on. Here is my output
// activity starts
08-04 17:24:17.643: ERROR/PlayActivity(6215): onStart executes ...
08-04 17:24:17.643: ERROR/PlayActivity(6215): onResume executes ...
// screen goes off
08-04 17:24:28.943: ERROR/PlayActivity(6215): onPause executes ...
08-04 17:24:32.113: ERROR/PlayActivity(6215): onStop executes ...
08-04 17:24:32.113: ERROR/PlayActivity(6215): onDestroy executes ...
08-04 17:24:32.983: ERROR/PlayActivity(6215): onStart executes .....................
View 3 Replies
View Related
Aug 25, 2009
I have a service that polls for data. To indicate this to the user I have a persistent notification in the statusbar. In some cases when the device goes low on memory it destroys the service but OnDestroy is not called. Later when there is available memory OnCreate is called. Is this normal behavior? I had hoped that OnDestroy would be called to I could remove the notification in the statusbar. Now the user thinks that the service is still running, while it has been stopped by the OS.
In order to restart the polling how do I know that the OnCreate is really a restart event and not first time creation of the service? I thought about checking for the presence of the notification in the statusbar, but I couldn't find a API to check if a notification was showing or not. I have not tried "SetForeground" on the service, since the service isn't that important to the user, but maybe that would minimize the problem.
View 4 Replies
View Related
Jul 27, 2009
Finally after many days of getting StackOverflowError, I've tracked down the issue and fixed it, only to find that my game's serialization takes about 5 -10 seconds on the emulator and most likely around that in the target. So far my the lifecycle of my game is as follows
onCreate - check if serialization file exists, if it does, de- serializes it. (~ 5-10 seconds) onPause - if the game is not complete, then serialize it (~ 5-10 seconds) I remember reading somewhere that another activity's onResume will NOT get called UNTIL the previous activity's onPause has ended. So I am worried that my game is delaying another activity that wants to start from doing so i.e like a phone call etc. I think speeding up the serialization is not going to be feasible, so any ideas on what I can do? Can I serialize in the onDestroy instead of the onPause? I read that the onPause is the only safest place to store the state.
View 8 Replies
View Related
May 30, 2010
I have an Android activity which in turn starts a thread. In the thread I open a persistent TCP socket connection. When the socket connects to the server dynamic data is downloaded. The thread sends messages using Handler-class to the activity when data has been received. Now if the user happens to switch from portrait to landscape mode the activity gets an onDestroy call. At this moment I close the socket and stop the thread. When Android has switched landscape mode it calls onCreate yet again and I have to do a socket re-connect. Also, all of the data the activity received needs to be downloaded once more because the server does not have the ability to know what has been sent before, i.e. there is no "resume" feature.
Thus the problem is that there is alot of data which is resent all the time when landscape mode is changed. What are my options here? Should I create a service which handles the socket traffic towards the server thus I always got all the data which the server has sent in the service. Or should I disable landscape mode all together perhaps? Or would my best bet be to rewrite my server which is a VERY BIG job
View 1 Replies
View Related
Jul 24, 2010
I have a scrollable map app which for now has a huge bitmap. It loads fine on startup, but when it looses foreground status and the user brings it backs again im getting an out of memory error. In onPause it trashes the bitmap using recycle, and marks it as null. The onResume checks to see if map==null and will load the bitmap back again, which is crashing the program despite me recycling the bitmap...Here are some bits of code. All of the other references to Bitmap map first check if it is null before loading/drawing..............
View 1 Replies
View Related
Jan 2, 2014
My app is a launcher. It gets killed frequently by OS when it running in background. It has to restart and reload data, which taks a long time.How to make it get less chances of being killed ?
View 1 Replies
View Related
Aug 16, 2010
The Xperia X10, X10 mini and X10 mini pro smartphones will all receive software upgrades during their lifecycle to improve performance and add new communication and entertainment experiences. From Q3 2010 onwards, the Xperia™ X10, X10 mini and X10 mini pro smartphones will be upgraded to run on the Android 2.1 operating system in selected markets. The Xperia™ X10's position as the best multimedia Android smartphone will be strengthened through the addition of HD video recording as part of the same Q3 upgrade. A further upgrade to the Xperia™ X10 in Q4 will make it possible to connect wirelessly to and display content on your television and enhance the Timescape™ and Mediascape applications..................
View 2 Replies
View Related
May 20, 2010
So I have 2 reports now of my app causing a crash/reboot cycle the user can't always break from. I cannot reproduce this on my phone, and I am wondering what might be causing something like this? Would running out of memory or something cause this? Because I can't reproduce it, I can't look at the logs or anything.
Has anyone experiences anything similar? For reference, my app runs a foreground service which utilizes the AlarmManager. It starts automatically on boot_completed (which is probably why the cycle happens). One of the users who reported this, said it only happened when they plugged their phone into a PC.
View 3 Replies
View Related
May 1, 2009
I found that the old bug reported in http://code.google.com/p/android/issues/detail?id=1578 where only a power cycle brings back the camera still persists with the official Cupcake firmware on my ADP. When it happens - and I've encountered it several times in a few days now - no camera application can access the camera. A power cycle is needed to recover from this locked camera state.
View 8 Replies
View Related
Aug 23, 2010
Only started happening since the most recent update. before that it was good. Updated both phone and computer side software and now it locks up my 64bit windows ultimate machine every 2nd time I log into PhoneMyPc. I can log in once fine, the second time will cause the computer to freeze.
View 2 Replies
View Related
May 26, 2010
I know there are widgets to turn BT on/off manually.I'm looking for an app that, when run, will turn it on, then off, then on again (or something similar).I have found that, if I do this manually with my official 2.1 Hero, I can connect properly in my car. So, it would be nice to automate it.
View 2 Replies
View Related
Jul 16, 2010
How do I change the slot cycle on the X? The ## codes don't work on this.
View 5 Replies
View Related
Jun 10, 2010
I am newly rooted running aloysious Rom but when I press ##778 it does nothing but sit there. Is there any way You can change it. I only get 5 rings before voicemail.
View 6 Replies
View Related
Oct 28, 2009
I frequently run into the problem that I have to preserve state between several invocations of an activity (i.e. going through several onCreate()/onDelete() cycles). Unfortunately, Android's support for doing that is really poor. As an easy way to preserve state, I thought that since the class is only loaded once by the class loader, that it would be safe to store temporary data that's shared between several instances of an activity in a static Bundle field. However, occasionally, when instance A creates the static bundle and stores data in it, then gets destroyed, and instance B tries to read from it, the static field is suddenly NULL. Doesn't that mean that the class had been removed and reloaded by the classloader while the activity was going through a create/destroy cycle? How else could a static field suddenly become NULL when it was referencing an object before?
View 2 Replies
View Related
Nov 10, 2009
Device: Motorola DROID
I just wanted to post an issue I found. I downloaded ES File Explorer and was browsing a shared folder of pictures on a desktop. I selected a picture and, with the file explorer's picture viewer, browsed the next few pictures sequentially. I found one that I wanted to use as a background, so with a menu option, I chose set as background. The device froze, and started a never ending reboot cycle. I had to hard reset the device and wipe it with the POWER + X button option. I am not sure if this is an ES File Explorer problem or a problem with file transfers initiated some way other than copy and paste, or just simply trying to assign a remote path as a background image location, but I thought it necessary to post. I have sent this to the author of the file manager as well.
View 3 Replies
View Related
Oct 26, 2009
I'm trying to create an application that has 3 tabs. Under the middle tab should be a ListView. It starts up fine (on the left tab) but when I click the middle tab it crashes.
The other two tabs are static data specified in the main.xml file. But the middle tab, I try to create dynamically. Here's the code from the main onCreate function:
CODE:...............
Instead I appear to get an exception:
CODE:...............
ContactListActivity is defined this way:
public class ContactListActivity extends ListActivity { ...
I get the feeling that I'm supposed to create the Intent with something like Intent.ACTION_VIEW but this is where I get lost. If this is the problem, I could try stuff until it works, but I'd prefer to understand why.
Or is ContactListActivity supposed to override something ?
View 2 Replies
View Related
Feb 8, 2010
I have a problem with rotation, during my ListActivity is loading data from the network. To do it I use a background thread which recovers data and put them inside an ArrayList. While this thread works, there is Progress dialog activated in foreground. For the rotation I use the method with onRetainNonConfigurationInstance() to save my ArrayList's state. After android calls this method, I call dismiss() on the progress dialog on onStop(). Then the activity is created as new with onCreate(), but it use the getLastNonConfigurationInstance() to recover the ArrayList's state. Now, my problem. If I rotate from portrait to lanscape when the download is terminated and I see the data in portrait yet, everything is ok. If I rotate during progress dialog is showing I have two cases: 1- onRetainNonConfigurationInstance() saves the arraylist fully recovered, the thread terminates and everything is ok. 2- onRetainNonConfigurationInstance() saves the arraylist empty, i think the download isn't finished yet. The onCreate is called and my list is empty, the thread terminates, but i don't see anything in my list. If I am in this case and I still rotate from landscape to portrait now I can see my list full with all the data. Why? Where am I wrong?
View 7 Replies
View Related
Jun 30, 2009
I create a ListView in my activity and set its ChoiceMode to CHOICE_MODE_SINGLE, I also set its layout to simple_list_item_single_choice. But when i click on it onItemSelected() is never called and getCheckedItemPosition() returns -1. Why? the sample List10.java of ApiDemos uses ListActivity works well which just set the same as I done in my app. Any ideas?
View 2 Replies
View Related
Jan 13, 2010
I want to create a custom list view in my application. I want it to lay over the top of the application screen, with portions of the screen not filled by the listview showing the underlying application. I've been reading about ListActivity, how it can be started to handle item selected callbacks. I've also read about people simply inserting onClick handlers into the listview as it is drawn. I'm trying to decide the best way to proceed. Is it "dirty" to attach onClick handlers to the rows of a listview? It doesn't seem like the best approach, for instance, it only handles Touch Mode, not the DPAD clicks. This approach doesn't seem like what the architects had in mind. On the other hand, I don't see a good way that I can start a list activity and still have access to all the application variables I need. Do I pass the application in the context and refer back to it from even handlers after casting the context back to it's original class?
View 5 Replies
View Related
Jul 27, 2010
I know this may be a pretty simple question, but i am having problems trying to find what i am looking for. I have written an application that uses a listview activity. but now that i think more about it, i would like to have other items included to give the status of the app, etc that i just want to be displayed and not scrolled so it wont be entered into the database. does anyone have a good link to an example for this>
View 3 Replies
View Related
Jan 11, 2010
I have an ListActivity that I wan't to add a logo to at the top above the list but I'm unsuccessful. This is what my layout looks like at the moment.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/logo" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:drawSelectorOnTop="false"> </ListView> <TextView android:id="@+id/empty" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/list_empty" /> </LinearLayout>
Then I add an drawable to the ImageView logo in onCreate. I've managed to show either the ListView or the ImageView but never both of them in the same LinearLayout. Is it possible to add other views together with a ListView?
View 3 Replies
View Related
Sep 8, 2009
I am using a ListActivity. Each list entry contains an ImageView and a TextView. I have a huge list and has been getting Out of Memory errors once I scroll through a fair amount of them. I figured I need to reduce the size of the images but I am wondering what happens to the objects once the list entry is hidden from view (as i scroll down the list). I have read somewhere that the list entry objects are automatically re-use. But what happens to the drawable images which were loaded into the ImageView? IF the ImageView object is reused, what happens to the binary image? Are they freed automatically? How do I prevent the OutOfMemory exception? I want to do something similar like the Android Market. As one scroll downwards the images are loaded and new entries are loaded. The Markey can have a long list which one can scroll down and all the way back up again without any problem. The only difference being mine throws OutOfMemory Exception. Advice anyone?
View 2 Replies
View Related
Dec 29, 2009
I have a list Activity 4 which i have extended the BaseAdapter and the getview looks like this.
public View getView(int position, View convertView, ViewGroup parent) {
View row=null;
for(int i=0;i<10; {
row = convertView;
if(row==null) {
LayoutInflater inflater = mContext.getLayoutInflater();
row = inflater.inflate(R.layout.parsed,null); }
TextView id = (TextView)row.findViewById(R.id.id);
id.setText(idvector.elementAt(position));
TextView photo = (TextView)row.findViewById(R.id.photo);....
View 4 Replies
View Related
Feb 2, 2010
I am having a problem.I want to explain in detail. 1)I am Having an TabActivity with 5 tabs. I loaded content as follows.
CODE:............
And the Problem is If i want to start activity which is not specified in tabhost in above Java code,it is going out of tabactivity. ie.,It is not coming in tabactivity.
2)But i want to have all the activities under tabActivity.
View 4 Replies
View Related