Android :: Insufficient Memory Error When Launching Application For Second Time After Calling Finish - In Main Activity

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

Android :: Insufficient Memory Error when launching application for second time after calling finish -  in main activity


Android :: Calling Finish() After Starting A New Activity

Apr 26, 2010

The first Activity that loads in my application is an initialization activity, and once complete it loads a new Activity. I want to ensure if the user presses 'Back' they go straight to the Launcher, and not the initialization screen. Side note, is this even the best approach, or would this be better done with some kind of Intent Flag?

Is it correct to call finish() after calling startActivity() on the new activity?

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

I'm still taking in the whole 'Message Queue' method of doing things in Android, and my assumption is that calling startActivity() and then finish() from my first Activity's onCreate() will log each respective message in the message queue, but finish execution of onCreate() before moving on to starting the next Activity and finishing my first one. Is this a correct understanding?

View 1 Replies View Related

Android :: 1.5 And 1.6 After Calling Finish Activity And Home Button

Jan 12, 2010

I open splash screen at the end i call finish() then i moved to browse page. At the browse page when i click on home button it hide the application.(b/c of Android's Multi tasking feature) When i go to Android's desktop launch application again it starts from splash screen. Android Platform 1.6

I open splash screen at the end i call finish() then i moved to browse page. At the browse page when i click on home button it hide the application.(b/c of Android's Multi tasking feature) When i go to Android's desktop launch application again it always starts from browse screen instead of splash screen why is that..............

View 1 Replies View Related

Android :: When Does Activity Object Really Get Killed After Calling Finish()

Nov 5, 2010

I created a thread in my activity, and that thread will print out the value of my instance variables in my activity after running for about 10 seconds. I pressed the back key to destroy my activity before the thread prints out the values, and when the thread reaches that line of code, it can still print out the values correctly. That means even though the activity is finished, the java object of the activity is still there. Will the object always be there? Or it is just waiting to be GCed? Or it will be killed only when Android needs memory?

View 2 Replies View Related

Android :: Return To Previous Activity Without Calling Finish() / Save This Information?

Oct 26, 2009

I have an android application with a LOT of activities, think of something like a book where every page is a new activity. The user can make changes in each activity, for example highlight certain texts with different colored markers etc. and it's crucial that I'll remember this information as long as the application stays alive (and I don't want/need to remember any of this when it's not). As I understand the best mechanism for storing this kind of information is via onSaveInstanceState(Bundle outState) and onCreate(Bundle)/onRestoreInstanceState(Bundle) rather than lets say, the Preferences mechanism. My only problem is that the user can navigate backwards to previous pages (Activities) and the only way i know of achieving this is by calling finish() which of course kills the current activity without calling onSaveInstanceState(Bundle outState) and even if it did call it, the next time I would launch an activity representing that page it would be an entirely new instance. So my question is: Is there a way to go back to the previous activity without calling finish()? or, is there a better way to save this information? maybe through static variables?

View 1 Replies View Related

Android :: Main Activity To Browser Activity Error

Nov 7, 2010

I have a main activity, then i call a new activity intent from this. Lets call this SecondActivity. Then from my secont activity i call a browser intent. Then my browser intent call my second activity's onNewIntent method.Evereything work fine, but when i click on "back" button on my phone on my second activity, i will not going to my main activity, but the browsers activity, why?

View 1 Replies View Related

Android :: Free Up Memory By Finishing An Activity After Calling Another?

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

Android : Error While Calling An Activity From Another / How To Fix

Apr 4, 2010

me and my partners are working on developing a pwa client for android Am getting an error while calling an activity from another activity.the error is as follows...

View 3 Replies View Related

Android :: Launching Another Activity From Application

May 22, 2010

I am trying to launch another application from my Activity. Something weird happens when I am running this code :
Intent myIntent = new Intent( Intent.ACTION_MAIN, null );
myIntent.addCategory( Intent.CATEGORY_LAUNCHER );
myIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED );
ComponentName compName=new ComponentName(myArray[i][0], myArray[i] [1] );
// String[][] myArray myIntent.setComponent( compName ); startActivity( myIntent );

I have this error :
android.content.ActivityNotFoundException: Unable to find explicit activity class { com.android.settings/com.android.settings.Settings};
Have you declared this activity in your AndroidManifest.xml?
But when I replace this line
// myArray[i][0] = "com.android.settings" // myArray[i][1] = "com.android.settings.Settings" ComponentName compName=new ComponentName(myArray[i][0], myArray[i] [1] );
with ComponentName compName=new ComponentName("com.android.settings","com.android.settings.Settings");
And without any modification in my manifest, it works!

View 2 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity - Getting Error

Sep 11, 2010

I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code:

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

I'm calling this code from an activity, so I don't know how I could be getting the following error...

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

Is this really what you want?

View 1 Replies View Related

Android :: Activity Finish Method Waits To Finish?

Aug 14, 2010

With this sample code, the activity is told to finish, but continues execution afterwards and displays the message. I'm trying to understand why this happens. The only fix I can think of is to place 'return' after finish.

public void someMethod() {
if( valueIsTrue) {
startActivity(new Intent(this, NewActivity.class));
CurrentActitivy.this.finish();

// return; // if uncommented, Toast doesn't show
}
Toast.maketext(this, "Some message", Toast.LENGTH_SHORT).show();}

View 1 Replies View Related

Android :: Application Launching Timeout Expired - Exception Error

Sep 13, 2010

I have one application in android when I run that application it shows that exception

09-13 16:38:25.049: WARN/dalvikvm(269): VFY: arbitrarily rejecting large method (regs=132 count=21332)
09-13 16:38:25.049: WARN/dalvikvm(269): VFY: rejected Lcom/ExtraCharge/Calc;.onClick (Landroid/view/View;)V
09-13 16:38:25.059: WARN/dalvikvm(269): Verifier rejected class Lcom/ExtraCharge/Calc;
09-13 16:38:25.059: WARN/dalvikvm(269): Class init failed in newInstance call (Lcom/ExtraCharge/Calc;)
09-13 16:38:34.883: WARN/ActivityManager(64): Launch timeout has expired, giving up wake lock!
09-13 16:38:34.999: WARN/ActivityManager(64): Activity idle timeout for HistoryRecord{43f8da58 com.ExtraCharge/.Calc}

View 1 Replies View Related

Android :: Application Component Not Instantiated Before Launching Activity

Dec 17, 2009

I got a null pointer exception in an Activity onCreate() while trying to access my Application object (extended from android.app.Application).This exception occurred very rarely and i have no way to reproduce this again.My App starts a service on BOOT_COMPLETED intent and the null pointer exception seems to have occurred during boot up. Can somebody please throw some light on this issue? Application should have been created before creating any activities.

View 2 Replies View Related

Android :: Application Without Main Activity?

Oct 5, 2010

Is there a way to manage application activities by hand, like this: user activating an application from menu, it does some initialization, then creates some activity (is it necessar y to declare all activities in the application manifest?), and listens to it's events. On some event application decides to close one activity and open another - so it contains all the application logic. Didn't found anything like this in examples, they all have all the logic in the activity classes. Maybe I need to user Services? (Maybe I don't understand right, what an activity represents. For me it's like window in windows, or Displayable in j2me) I'm very new to android development, trying to understand the basics.

View 4 Replies View Related

Android :: What Method Of Main Activity Executes When Application Closes?

Oct 29, 2010

Can anybody tell me what method of an activity executes when an application closes?. Like I have a main activity and if I press back button on my phone. The Application closes so I want to know what method executes at that time.

View 1 Replies View Related

Android :: App Does Not Quit On Calling Finish() / What's Cause?

Apr 28, 2009

I have been developing a game on Android and wrote a wrapper for J2ME classes,

When notifyDestroyed() is called in my ME program and calling finish() but the application doesn't close correctly.

The App goes to background and when launched again it shows an error message and presents an option to "force close" the App, if i force close it and launch again, the app launches fine but again the same has to be repeated upon every launch..

Can you please explain why the App is not being erased from memory when finish() is called.

when i check the log i found no exceptions when closing but when launched again it throws a null pointer exception.

for now to work around I placed "System.exit(0)" after calling finish () so that the app is exited abruptly, but am waiting for a valid answer on whats going on behind...?

View 9 Replies View Related

Android :: Calling Finish() In OnResume()?

Sep 8, 2010

I've been using code like: activity.finish(); activity.startActivity(new Intent(activity, activity.getClass()));

in two places: onResume(), and in an onClick() method of an AlertDialog. I'm getting the desired results when the code is called from onClick(), but I get mysterious null pointer exceptions while the runtime is trying to execute my onPause(). Is calling finish() from within one of the Activity lifecycle callbacks always a bad idea?

This code makes me nervous even though it works in the onClick(). After I call activity.finish(), I would think activity is in a questionable state by the time activity.startActivity() is invoked. Seems like an invitation to race conditions.

My use case is setting UI preferences (e.g. a different layout) in a PreferenceActivity. When I return to the main activity's onResume(), I check for preference changes and if a new layout is requested, I use the code snippet above.

View 10 Replies View Related

Android :: OnSaveInstanceState Function In Main Activity Of TabHost-based Application

Aug 30, 2009

I've implemented an onSaveInstanceState function in the main activity of my TabHost-based application. I need to save the state of various objects I am keeping in memory that I have all marked as serializable, as well as some basic int and string values. I have stepped through my application and watched it call the onSaveInstanceState function and presumably save everything without any manner of exception or problem. The issue is that my onCreate function is being called with a null Bundle value every time after I start the application again. I'm really at a loss and unsure why it would call the save but not pass anything into the create.

View 1 Replies View Related

Android :: Shouldn't Calling FinishActivity Cause Finish To Be Called?

Nov 11, 2010

I have overridden the finish call in a sub-activity like so

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

I am calling finishActivity on this sub-Activity from the Activity that started it for result. But I am not seeing the finish being hit. Instead it goes directly to onPause.

View 2 Replies View Related

Samsung Captivate :: Files Folder Won't Work / Get "error While Launching Activity" - Fix It?

Oct 4, 2010

For some reason My Files folder won't work. It's not showing in my app drawer. I can find it with FolderOrganizer and make a shortcut but I get "error while launching activity" error. Any ideas?

View 2 Replies View Related

Android :: OnStop And OnDestroy Aren`t Invoked After Calling Finish()

Oct 14, 2010

i`ve got some problems with finish() method. I expect what after calling on my Activity finish() method onStop and onDestroy must be triggered(or am wrong??), in majority of examples they are, but Scenario: - reboot phone - launch activity - invoke finish() onPause is triggered but afterwards they are no calls to onStop() and onDestroy()I`ve noticed, that those calls are triggered after launching any other activity.

View 7 Replies View Related

Android :: Out Of Memory Error On Large Bitmaps And Activity Life Cycle

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

General :: Insufficient Memory In SGS Duos?

Mar 29, 2014

I'm.using rooted Samsung galaxy s duos suddenly I can't install some apps which are less than 20MB. It says insufficient memory. but I can install big apps which have size more than 40MB. I use Link2Sd to move apps to exernal storage.

View 6 Replies View Related

Android :: Finish Any Previous Activity In Stack From Current Activity?

Apr 27, 2010

How to finish any previous activity in application stack (at any level , I mean not immediate parent) , from current activity like on some particular event I want to invalidate this previous activity?

View 1 Replies View Related

HTC Incredible :: Says Insufficient Storage - When Clearly Have More Than Enough Memory Left

Jul 19, 2010

Today I went to install google earth to m phone. It would complete the download and kept telling me I dont have sufficient storage.I'm thinking there is no way I could have used 8 gigs of internal memory already, so I go to phone storage and see that I have 6.38 GB of internal storage left. So how is it that a 22mb download wont download?

View 4 Replies View Related

Android :: Finish Activity Not Started From Current Activity

May 1, 2010

I have following problem with my application: From my main activity ("activity 1"), there is a menu from which user can launch an action. This action will result in an Intent being received by a BroadcastReceiver, defined in my application. Finally, this BroadcastReceiver will start an activity ("activity 2") to deal with this intent.

The problem is that I have a "quit application" entry in my menu, and I can only finish() currently active activity. ie I am not able to finish "activity 1" from the menu of "activity 2". And I can't use startActivityForResult() as "activity 2" can't be started from "activity 1". Any suggestion would be much appreciated Thank you very much guys, regards.

View 4 Replies View Related

General :: Insufficient Storage Available Error On Installing APK On Android (4.1.2)

Dec 25, 2013

I'm getting this error when I try to install or update almost every APK on my Android. SOME will install or update and I can tell you there's nothing to do with file size. The storages seem to have plenty of free space, apps install smoothly when I factory reset my phone, but after a few days I start getting this annoying error.

I'm running the latest Nightly build from CyanogemMod for LG p720h (Yea, it's not stable and I know I should expect some... erm... bugs). It's Android 4.1.2.

I know the Internal Storage is emulated and have tried many many many fixes I found in this very forum and all over the internet. I'm a game developer so I know a few things about adb shell/logcats but couldn't find/understand anything analizing those during an APK install. I can provide logs, etc.

View 7 Replies View Related

General :: Can't Get Rid Of (download Failed - Insufficient Memory) Status

Sep 30, 2013

i've got a droid razr maxx running jb 4.1.2. at one point i had maxed out the storage space on both the SD card and the ~8gb of internal phone memory, so as i went to make a download i got a little error up top that said the download failed due to insufficient memory. i took care of the problem and completed the download, but ever since then that little !-in-triangle status has been up top on my status bar, always popping up atop the list of alerts that come up when i pull the top menu down. clicking on it sends me to my downloads page, so i've sorted out all of the filenames even remotely similar to that one and deleted them from the downloads page....

i can power off the phone, reboot it.... no matter what that status informing me that the download failed due to insufficient memory won't go away.....

View 3 Replies View Related

General :: Changing Wallpaper - Getting Notification Insufficient Memory?

Oct 23, 2012

Anytime i try changing my wallpaper i get the notification that insufficient memory. what should i do?

View 1 Replies View Related

Android :: Application - Activity's Memory Management

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







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