When running the trivial test activity below on a Samsung Galaxy Tab 10.1" (Android 3.1), I see a short flash of the home screen background, before TestActivity2 is started.
This flash is not seen
- when running without the FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
- when running on a Galaxy Tab 7" running Android 2.3
Any idea what is causing this flash and how I can avoid it?
public class TestActivity1 extends Activity
{
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView t = new TextView(this);
t.setText("TestActivity1");
t.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
//start TestActivity2
Intent intent = new Intent(getApplicationContext(), TestActivity2.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(intent);
}
});
setContentView(t);
}
}
When comparing the LogCat of a test-run with and without the FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, I noticed the following difference.
With FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
... INFO/SurfaceFlinger(223): id=71 Removed com.zappware.test/com.zappware.test.TestActivity1 idx=2 Map Size=3
Without FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
... INFO/SurfaceFlinger(223): id=75 Removed com.zappware.test/com.zappware.test.TestActivity1 idx=3 Map Size=3
Maybe this can help?