how to start application in last viewed activity in previous session

by greg » Thu, 22 Apr 2010 02:30:08 GMT


Sponsored Links
 I'm writing an application consisting of several activities and, on
restarts, I'd like the application to initially display the
application's activity that was the last to display in the
application's previous session.

I save information about the last activity in SharedPreferences and
I'm trying to start that last activity with a call to
startActivity(intent) from my Application's onCreate handler.  The
problem is that if I don't set the intent's FLAG_ACTIVITY_NEW_TASK,
the result is a run-time exception message in logcat suggesting that I
should set the flag.  And if I set that intent flag, the correct
activity gets started but doesn't fully initialize resulting in null
pointer exceptions (which don't occur when I don't attempt to start
the activity from my Application class).

- - -

W/dalvikvm(  805): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime(  805): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(  805): java.lang.RuntimeException: Unable to create
application com.test.tangled.TApplication:
android.util.AndroidRuntimeException: Calling startActivity() from
outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK
flag. Is this really what you want?

- - -

Any tips on how to correctly start a particular activity from the
Application class's onCreate handler?

Thanks,
Greg

--



Other Threads

1. facebook android 2.0 was Jubeh Android 2.0 buat dream

Bagi apknya dong bro,sapa tau bisa buat donut ato cupcake

sent from magix donut





guys

fb android 2.0 ini punya kemampuan untuk sync contact, ini bisa ditaro
di ROM 1.5/1.6 ga ya?

barusan coba, seneng juga liat contact sync dari FB qeqeqeq...

tku


--~--~---------~--~----~------------~-------~--~----~
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click  

2. facebook android 2.0 was Jubeh Android 2.0 buat dream

Thank you bos dzikki :-)


Sent powered by Sinyal Kuat INDOSAT

-----Original Message-----
From: Dzikki Muhammad <dzikki.gad...@gmail.com>
Date: Fri, 20 Nov 2009 09:06:39 
To: <id-android@googlegroups.com>
Subject: Re: facebook android 2.0 was Re: [id-android] Re: Jubeh Android 2.0 
 buat dream

ini file facebooknya, saya ambil dari android AOSP2.0 yang diextract.
ketika saya install ada pilihan untuk sync contact, ga tau ini karena
facebooknya atau karena ROM nya.

saya belum coba juga :p
have fun




--~--~---------~--~----~------------~-------~--~----~
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click  

3. How can I change the look of the front screen of the Android?

4. pressed image not showing !

5. How do I create a jar containing the .class files in bin?

6. android.R.drawable.ic_menu_home - can not use

7. Talking to service Daemons / init.rc help