これが一般的な問題であることは知っていますが、解決策が見つかりませんでした。5秒後に始まるインテントを作ろうとしています。そのため、アプリケーションが起動すると、1 つの画面 - 5 秒のスリープ - もう 1 つの画面が表示されます。エラーはありません。他のクラスが表示されないだけです。
アプリケーションが開始する最初のクラス、名前は Acilis.class
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.acilis);
Thread sayac = new Thread(){
public void baslat(){
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
Intent intent_basla = new Intent("android.example.CINSIYET");
startActivity(intent_basla);
}
}
};
sayac.start();
}
私も試しました
Intent intent_basla = new Intent(Acilis.this, Cinsiyet.class");
そしてxmlファイル
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Light.NoTitleBar" >
<activity
android:name="com.example.Acilis"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.Cinsiyet"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.example.CINSIYET"></action>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>