I have a function calling an activity, but the activity is not called and instead, the MainActivity is called. From what I can see there is nothing unusual about the call. I can follow the intent all the way through the source code of activity, and I see the intent is the desired activity.
I create the intent:
Intent startNewActivityOpen2 = new Intent(this, com.assistek.ediary.TransitionLandscape.class);
setExtrasStartActivity(startNewActivityOpen2, extras);
Here is the method I call:
protected void setExtrasStartActivity(Intent i, Bundle extras) {
// copy over all extras
if (extras != null) {
if (!extras.isEmpty()) {
i.putExtras(extras);
}
}
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//I can see here that the the intent is correct
startActivity(i);
finish();
}
Logcat:
12-10 19:09:56.041 2857-2857/com.assistek.ediary D/Base Activity: **********Pause class com.assistek.ediary.TransitionLandscape **********Pause Navigate: true **********Resume class com.assistek.ediary.TransitionLandscape **********Pause class com.assistek.ediary.TransitionLandscape **********Pause Navigate: false 12-10 19:09:56.061 539-9188/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.assistek.util.homelauncher/.HomeLauncherActivity} from pid 0 12-10 19:09:56.181 2857-2857/com.assistek.ediary D/Base Activity: **********Focus: false Activity: class com.assistek.ediary.TransitionLandscape 12-10 19:09:56.191 1002-1006/? D/dalvikvm: GC_CONCURRENT freed 479K, 12% free 7739K/8708K, paused 3ms+3ms, total 34ms 12-10 19:09:56.191 539-22740/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.assistek.ediary cmp=com.assistek.ediary/.Home} from pid 1002 12-10 20:19:49.371 1002-1006/? D/dalvikvm: GC_CONCURRENT freed 842K, 11% free 7767K/8708K, paused 3ms+1ms, total 48ms 12-10 20:19:49.501 539-620/? D/dalvikvm: GC_FOR_ALLOC freed 241K, 19% free 16643K/20352K, paused 58ms, total 59ms 12-10 20:19:49.501 539-620/? I/dalvikvm-heap: Grow heap (frag case) to 16.531MB for 251120-byte allocation 12-10 20:19:49.561 539-620/? D/dalvikvm: GC_FOR_ALLOC freed 4K, 19% free 16884K/20600K, paused 56ms, total 56ms 12-10 20:19:49.621 539-620/? D/dalvikvm: GC_FOR_ALLOC freed 262K, 20% free 16621K/20600K, paused 58ms, total 58ms 12-10 20:19:49.621 539-27162/? I/ActivityManager: moveTaskToBack: 5106 12-10 20:19:49.641 539-22745/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.assistek.util.homelauncher/.HomeLauncherActivity} from pid 0 12-10 20:19:49.661 6240-6240/com.assistek.ediary D/Base Activity: **********Stop Navigate Away false
Why is the Home Launcher getting called?
EDIT: If I call another activity, the correct activity displays.
EDIT: Here is my manifest
<activity
android:name=".TransitionLandscape"
android:configChanges="orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:noHistory="true"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateHidden">
</activity>
Is com.assistek.ediary
your app's package name?
Looks like you are trying to call other app's activity which has HomeActivity as their launcher activity so its therefore Home activity is called.
Intent secondActivityIntent= new Intent(getApplicationContext(), SecondActivity.class);
intent.putExtra("myKey", "MyValue");
context.startActivity(secondActivityIntent);
I not a 100% sure if this is the right answer but it's worth a try,
<activity
android:name="com.assistek.ediary.TransitionLandscape"
android:configChanges="orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:noHistory="true"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
and also make sure that you are overriding this and not anything else,
@Override
protected void onCreate(Bundle savedInstanceState) {
}
User contributions licensed under CC BY-SA 3.0