about onRestoreSavedInstanceState: I misunderstood the doc, I now
understand why it was not called in my case. Sorry.
about onNewIntent:
In fact there is a very strange problem: if I launch my application
from Eclipse, the mechanism will not work, but if I shutdown my
emulator then relauch emulator then my application it works...
Here is a simplified test app which illustrates the mechanism of
relaunching my app with a "command" from the notification bar. This
application always works, strangely, the mechanism is exactly the same
in my real application...
public class Test extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
Log.d("test", "onCreate(savedInstanceState=" + savedInstanceState
+ ")");
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
displayIntentExtras();
Intent intent = new Intent(this, Test.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("dummy", "dummy");
Notification notification = new Notification(R.drawable.icon,
"relaunch with dummy extra", System.currentTimeMillis());
notification.setLatestEventInfo(this, "relaunch app",
"relaunch with dummy extra", PendingIntent
.getActivity(this, 0, intent, 0));
NotificationManager notificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, notification);
}
private void displayIntentExtras()
{
Log.d("test", "dummy=" + getIntent().getStringExtra("dummy"));
}
@Override
protected void onStart()
{
Log.d("test", "onStart()");
super.onStart();
}
@Override
protected void onRestart()
{
Log.d("test", "onRestart()");
super.onRestart();
}
@Override
protected void onNewIntent(Intent intent)
{
Log.d("test", "onNewIntent(intent=" + intent + ")");
setIntent(intent);
displayIntentExtras();
super.onNewIntent(intent);
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.test">
<application android:icon="@drawable/icon" android:label="@string/
app_name">
<activity android:name=".Test" android:label="@string/
app_name" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---