Android :: Simulate Killing Activity To Conserve Memory?
Mar 1, 2010
Android doc say:"When the system, rather than the user, shuts down an activity to conserve memory, ... "
But how to simulate this situation?I want to debug the onRestoreInstanceState method,but don't know how to.
View 2 Replies
Sep 27, 2009
Is there an easy way to simulate low memory inside the emulator?I'm interested to perform resource cleanups similar to this post
View 2 Replies
View Related
Apr 12, 2009
I've got an application that has (among other things) three Activities, let's call them A, B, and C. A is the main navigation point for the entire application, and launches B and C directly using startActivity(). They work fine that way. However, when I call C from inside B, I get a strange problem. The code for launching Activity C is exactly the same in both places. The problem is the hardware back button. In the emulator, it takes two presses of the back button in order to close Activity C and come back to B. On a G1, it takes 3 or 4 presses. Upon seeing this, I implemented the usual suspects in C - onPause(), onStop(), and onDestroy(), and onResume() in B. When I press the back button from C and it doesn't work, I get onPause(), onStop(), onDestroy () - in that order, but nothing happens. When it works (on press 3 or 4 on the G1), I get onPause(), then onResume() in B, then onStop() and onDestroy().
I've tried catching the key press of the back button and calling finish (), but that doesn't make a difference. Has anyone seen this? To pre-empt some questions: All C does is display some data. There are no threads or any other special resources that C might have an active handle to that's preventing it from closing. But out of curiosity, if it did, how would I detect that? Any ideas for further diagnostics here?
View 12 Replies
View Related
Nov 4, 2010
Running a rooted Evo (obviously) with OMJ 3.8. I have Sense running with Itching Thumb(which I love).
For about a month or so I have been using Autokiller Memory Optimizer which has improved me phone's performance (I determined this in a sisde by side comparison with my wife's unrooted evo. I know this is not a perfect test, but as OMJ uses a stock kernel it's close enough, IMHO)
Since I have been running Itching Thumb I have notices when switching apps Sense will occasionally get killed. I can only assume this is because of Autokiller.
When I looked on Autokiller Sense had an oom of 8, which with a memory use of 9mb and change makes it a candidate for being killed, I would assume. The oom for sense seems to bounce around a bit, it's usually 8, but I have seen 4 and 1 also.
This is a mild annoyance, waiting for Sense to restart, but if I could avoid it I'd like to. I've thought of a few possible fixes I would prefer not to do, which include:
Uninstalling Itching Thumb
Lowering the free memory threshhold on Autokiller
Temporarily lowering Sense's oom in Autokiller
What can I do to keep Sense from being killed? (I considered a bulletproof vest, but they didn't have one that fit) Can I lower it's oom? Any ideas? Or should I just suck it up and accept it and a byproduct of my tinkering?
View 7 Replies
View Related
Feb 22, 2010
Ok after seeing the somewhat heated threads on here about whether or not to use a task killer to help mange memory and improve performance on the droid Eris I decided to run my own little unscientific test.
So just a bit of background, Ive been in enterprise wide IT for 10 years now. I will say that my O/S knowledge is not exactly current but that may not be a bad thing for this. I will also state that what I report is just my own experience and I have not repeated is several times to validate anything. YMMV!
About four weeks ago my Eris was running like poo. Slow, lag city and getting almost unusable. I had been using Advanced Task killer quite liberally during this time trying to keep the device usable. Short term it seemed to help restore some of the response issues but it didnt take long before I was trying reboots to get the phone working well. Here is a list of apps I had installed at the time.
Pandora
Weather Bug
Shop Savy
Google Sky
Daily Dilbert
Bloom County
WiFi Analyzer
Silent Mode Toggle
Taskiller
SpareParts
battery Widget
Robot Guitarist
keyring reward
tv.com
NPR News
Movies
Shazam
Zedge
ip-calc
aldiko
JogTracker
UnitConverter
Backgrounds
photoshop mobile
plink art
Weather channel
Radar now
Last.fm
Plus a few others that had been removed.
That quite a few apps but not overboard in my book, and most seem to be pretty stable.
Anyway I decided to wipe the device and start over again, but with the debate raging I decided that I was not going to run any sort of task killer or other memory manager. And that I was going to run for at least four weeks and report the results. I will say I trimmed some of the redundant apps (weather bug replaced all the other weather apps nicely)
I have to say that over all I dont feel like I need a memory manager or task killer. It would be hard to say that the phone is a zippy as it was right after I wiped it, but as of now its no where near as laggy as it was before I wiped it. I feel my battery life is just fine, but I am not one who thinks that battery is an issue anyway. If there is 10% left when my head hits the pillow at night then I am a happy camper.
So this does beg the question what does using a memory manager really do for your experience on the phone? I cant for sure state that using a task killer caused my lag issues before, but it was not helping at the time either. My apps and usage have not changed very much other then not using a task killer and as of now my phone is running pretty darn well.
For me I am pretty firmly in the do-not-need-a-task-killer-camp for now. And before you flame or argue with me I challenge you to try it both ways for a while (with a clean wipe). I am sure that others have had a different experiences and maybe using one works for them.
View 3 Replies
View Related
Aug 19, 2009
Our application is defined to launch a SplashScreenActivity from Intent { action=android.intent.action.MAIN categories= {android.intent.category.LAUNCHER} . After the SplashScreenActivity does its work, it launches another intent to launch MainMenuActivity and finish() is called on SplashScreenActivity.
When we run our app for the first time on our phone, the SplashScreenActivity launches OK, and correctly launches the MainMenuActivity.
However, if we kill the app using TaskKiller, LOGCAT indicates that the application has been killed. I can't debug the app, because launching it from eclipse with the debugger makes it work OK, because it reinstalls the app. Perhaps there is a way to launch the app without reinstalling it?
Here is the Log of us killing our app...
When we launch the application again, the LOG messages for SplashScreenActivity are not logged and it looks from LOGCAT that Android is launching the MainMenuActivity instead. Here is the log...
Can someone Romaine, Diane help us understand what is happening? We saw this happening because some variables are initialized in SplashScreenActivity that aren't available with MainMenuActivity and we were getting NPEs.
View 3 Replies
View Related
Mar 5, 2010
Hope this hasn't been asked already, but here goes. When I had my G1 occasionally i would find a few apps running in the background needlessly, and would close them down. With the Nexus One every time i check, there is at least 15-20 apps running that dont need to be. Is there a way to minimize this to conserve battery?
View 2 Replies
View Related
Feb 26, 2010
My .mail folder contains a bunch of files I can't identify what they are or what they are used for. I have moved ALL THE FILES AND TOKENS to a temp directory and my Here seems to be working fine with the .mail folder empty. I think these files have something to do with email I receive and delete. Has anyone ever cleared out this directory to conserve storage space? Are these useless files and can be deleted?
View 7 Replies
View Related
May 20, 2010
When start Activity A, I found the memory usage of application is about 5MB. Then start Activity B from A via startActivity. In Activity B, I created a thread, and traverse file system in this thread, after traversing completed, call finish() and to return to Activity A. At this time, I found the memory usage of application is about 8MB (GC is forced before check memory usage). How to find Where memory leaks? By the way, I checked the memory usage with DDMS.
View 5 Replies
View Related
Sep 24, 2009
In my app activity A creates activity B, however when the back key is pressed it goes back to activity A. This is a simplified version of my application. I would expect memory to be reclaimed when going back to Activity A. Going to activity B allocates more memory. I am using dumpsys meminfo to get the allocated kbs. How can I easily tell what memory is creeping? I do not keep any references to activity B. I know about the ddms allocation tracker, but wondering if there is a more better tool to figure this out.
View 2 Replies
View Related
Aug 3, 2009
I have a activity MyActivity, which "kills" yourself using the finish () method. The problem is: after the kill operation, method onDestroy is called, but the object of type MyActivity is never garbage-collected (I forced the GC run). It is causing a memory leak, because MyActivity is launched many times, by other activities. Does anyone know when the Activity object is supposed to be garbage- collected, and what can be done to avoid the issue I mentioned?
View 2 Replies
View Related
Mar 1, 2010
I have a problem with my application, and it's about a Virtual memory error: ERROR/AndroidRuntime(19790): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
The story is like this: I have an activity (let's call it A), the user click on a button from this activity, then i will make an api call somewhere in the internet, and after the result is back i start a subactivity (let's call it B).
In the activity B i have to dinamicaly load some images from the resources folder. I load the images into bitmaps -> drawables -> imageviews. After the user click's on some buttons i have to setResult(..), finish(), and get back to activity A.
The thing is that, goes from activity A to B, then B -> A, then A -> B for a few times, my app crashes with the message above: it doesn't have enough memory to load the interface.
I can not maintain the activity B on the stack because i don't want the user to go to this activity without going through activity A first.
View 2 Replies
View Related
Aug 7, 2009
http://developer.android.com/reference/android/app/Activity.html
The Activity Lifecycle could have implementation and or design bug: One case is to initialize a big image in onCreate(), try to reuse the image during the whole lifecycle, and then recycle the image in onDestroy(). Test showed that onCreate() is called every time one navigate away from the activity and back again, but onDestroy() is not called at all. This behavour causes memory leaking for the big image (size 960*1920). After 6+ times away and back to activity, the system runs out of memory and has to kill the process.
One workaround is to initialize the big image in onResume() and recycle in onPause(), but that's not so good reuse.
Could it be better to change the process (as shown in the diagram) a little bit such as: Call onDestroy() first when a process is killed?
View 3 Replies
View Related
Feb 25, 2010
Hopefully the title wasn't to confusing but what I meant was the following:
Lets say activity A starts activity B by calling:
Intent myIntent = new Intent(Activity_A.this, Activity_B.class);
Activity_A.this.startActivity(myIntent);
Could I save/free up some memory by finishing Activity_A after Activity_B is begun (if thats even possible). Maybe through the following:
Intent myIntent = new Intent(Activity_A.this, Activity_B.class);
Activity_A.this.startActivity(myIntent);
Activity_A.finish();
Or would Acitivty_A call startActivity() and wait for Activity_B to finish before it called finish()?
The idea would then be that when the users end with Activity_B, it would just restart Acitivity_A (and finish itself in a similar fashion)? Would this create too much overhead? Thanks for any answers and I apologize if the formatting of this post isn't correct.
View 2 Replies
View Related
Oct 15, 2010
I'm writing a graphic design application for Android where the user can add several images to a document, where each image is stored as a Bitmap object. Each bitmap has roughly a dimension of 800x400 pixels and uses ARGB8888 pixel format (i.e. ~1.5Mb each).
I'm aware that most of the first generation Android devices have a 16Mb heap limit and this limit is 24Mb and larger for newer phones. I'm also aware that bitmap memory is allocated externally, but I'm confused and what the implications of this is.
My question is: How can I tell at runtime when adding a new Bitmap will get me too close to the memory limit?
Before someone suggests "don't use that much memory", I know that one option I have is to limit how many Bitmaps the user can create such that I know this limit is safe for the most basic Android phones. However, I'd like for phones with a bigger memory limit to support more bitmaps and/or bigger bitmaps.
I know to check for OutOfMemory exceptions when allocating bitmaps. However, there will be some situations where I've only got just enough memory left to allocate one more bitmap. After this point, the whole application will be unstable because even allocating small things like strings could cause an OutOfMemory exception. This is something I want to avoid.
I'm not sure how to define "too close to the memory limit", but I suspect something like "don't allocate more than half of your available memory to bitmaps" would work OK as my other data structures I store in memory are small in comparison.
View 3 Replies
View Related
Sep 10, 2009
As the title says? Or what situations can cause this method to return null? I would of thought it retained this object always.
View 2 Replies
View Related
Apr 14, 2010
I am using a simple frame animation and when I exit and reenter my activity the activity is still referenced in memory.
//This is a sample activity I created to simulate the problem public class MemoryLeakActivity extends Activity {
@Override public void onCreate(final Bundle savedInstanceState) super.onCreate(savedInstanceState);
} @Override public boolean onKeyDown(final int keyCode, final KeyEvent event) {
final Intent i = new Intent(MemoryLeakActivity.this, LeakyActivy.class);
startActivity(i); return super.onKeyDown(keyCode, event);
} }
View 3 Replies
View Related
Feb 16, 2010
I was wondering if it is possible to force the RecognizerIntent Activity (or any other Activity) to stay cached so that the launch time would be faster.
View 2 Replies
View Related
Jun 26, 2010
I'm currently debugging my app which is quite complex and has up to 5 activity levels. In order to detect memory leaks (i.e. activities that aren't removed from memory even finish() is called, due to some references held somewhere) I want to check which activities are still alive in memory. Currently I create hprof dumps, but it's not very convenient, cause every time I need to mount the sdcard, copy the hprof dump file from the sdcard to my PC, etc. (Side note: I already tried to automate the pulling of my hprof file more easily, but I'm on an unrooted device and adb pull <hprof file> won't let me / no permission.) Therefore I am wondering, if all I want to know is IF and WHICH activities are still currently alive in my memory, is there a way through the Android API or any other way on-the-fly with which I can achieve this (list all alive activities of my app), programatically.
View 2 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
Aug 23, 2010
I just signed up for these forums because soon I will be an HTC Desire owner in Canada. Having never owned a smartphone before I do have a few questions. The plan I intend on signing up for is the Telus Student 40 and that will come with only 100mb of data. Now I don't see myself being too data using heavy so I feel like I will be able to live with it. However I do have some questions regarding my data consumption.
1. Is it possible to completely stop all data usage by somehow disabling the data connection if I find myself reaching my limit?
2. What are ways to track my data usage to make sure I don't use too much data?
3. What are good ways to conserve data usage? I'm getting the feeling that there are some applications that will constantly be sending data back and forth updating themselves, is it possible to have these applications but stop them from constantly updating and only have them update when I want to access the application?.........
View 5 Replies
View Related
Apr 21, 2009
I have made a game with just one activity.. I just replace the views when I want to change screen. The game runs fine for a really long time inspite of what ever I do within the game.
But once I close the main game, by calling finish on the only activity in the application, and then when I start again, within the next 30 secs it crashes telling VM budget exceeded..
When I don't have a dispose() or a delete method in JAVA.. how the, am I supposed to remove the objects used in memory.. moreover I have android:launchMode="singleInstance" in my manifest
View 4 Replies
View Related
Feb 27, 2009
I run the emulator from the sdk version 1.1_r1 and when I try to make an outgoing data connection during a incoming call the data connection will not be esablished BUT it works fine if I disconnect the call. I have seen the same behaviour on other phones that run GSM instead of 3G. Are the emulator simulating GSM? If so can I switch to 3G or is there any other way that I can have a outgoing data connection during an incoming call?I have tried the "emulator.exe -netspeed" option but if I understand it correctly it only set the speed of the connection and not the connection mode.
View 3 Replies
View Related
Oct 27, 2010
What is the mechanism used to simulate SMS messaging between emulator instances? Does it use sockets? Is there documentation of this available?
View 2 Replies
View Related
Oct 7, 2010
Our app seem to misbehave sometimes when user plug USB cable to the device. Is there any way to simulate this event using Android simulator? Since it does not matter what type of USB connection is set (SD card access or just charging) I may just need the OS to "think" the USB cable has been connected and do what it does on the device. Can I achieve this in any sane way?
View 12 Replies
View Related
Oct 22, 2010
I want to simulate an onClick event or some of the other keyboard events, etc. is there a general framework to do that?
View 11 Replies
View Related
Mar 10, 2010
I have a requirement to implement an Exit button in my Android application. I don't really care about killing the activity stack, I just want to have the same effect as pressing the Home button. So that application state is saved and can be returned to. But this doesn't accomplish anything, the PhoneWindowManager does not get the key press.I assume I need to launch an Intent with the right info, but I haven't been able to figure out how that would be done.
View 6 Replies
View Related
Dec 23, 2009
Can I simulate an sdcard presence in the android emulator?
View 3 Replies
View Related
Aug 12, 2009
How to simulate a MMS message on emulator? From the eclipse android plugins, I can only see 'SMS' option. I don't see any MMS message.
View 4 Replies
View Related
Oct 13, 2009
I would like to check from my app whether the device has WiFi connectivity, but in order to do that, I must first find a way to get "WiFi" in the emulator. Just going to Settings -> Wireless controls -> Wifi says Unable to start Wi-Fi, while logcat says:How can I simulate WiFi connectivity in the emulator?
View 1 Replies
View Related