私には2つの関連する活動があります:Main
とShowResult
。2つ目は、のスレッドから起動されMain
ます。これはうまく機能しますMain
が、バックグラウンドになるとすぐにアクティビティは開きません。Logcatは異常を表示しません。
マニフェスト:
<activity
android:name="com.....ShowResultActivity"
android:launchMode="singleTop"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="com......MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
スレッドクラス内のハンドラー/スレッドから実行:
iOpen = new Intent(context, ShowResultActivity.class); // is written in the constructor
Bundle b = new Bundle(); // global
b.putInt("type", 1);
b.putString("url", value);
iOpen.putExtras(b);
context.startActivity(iOpen);
ShowResult:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
onNewIntent(getIntent());
}
@Override
public void onNewIntent(Intent i) {
Bundle b = i.getExtras();
int value = b.getInt("type");
String url = b.getString("url");
Log.e("opened :)", value+" "+url);
if(value == 0) {
showPictureAsync(url);
} else if (value == 1) {
showVideoAsync(url);
}
}