android - Issues with Translucent Theme -
android - Issues with Translucent Theme -
i have app has 2 activities. first 1 presented single button opens sec one.
here manifiest definition first one:
<activity android:name="com.example.buttonexample.mainactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity>
second activity:
<activity android:name="com.example.buttonexample.mainactivity2" android:label="@string/title_activity_main_activity2" android:theme="@android:style/theme.translucent"> </activity>
here how launch sec activity (via onclicklistener button on first activity):
public void startsecondactivityclick(view v) { intent startactivity2 = new intent(this, mainactivity2.class); startactivity(startactivity2); }
this works fine, when background app hitting home , foreground app. i'm noticing first activity continually creating/destroying itself. verified putting code in ondestory method increment static int:
private static int count = 0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); count++; } protected void ondestroy() { super.ondestroy(); log.i("mainactivity", string.format("destroyed, %d", count)); }
i've noticed removing translucent theme seems prepare this. question is there way translucent or similar have not restart? also, i'm curious why happens @ all. i'm testing on 4.0.1 ics on galaxy siii.
ok after digging able figure out why happening. had turned on 1 of developer options, "do not maintain activities.". after turning off stopped happening. suspect wouldn't happen in production people don't have setting on. can find under settings -> "developer options" on phones.
android android-theme
Comments
Post a Comment