package com.dswipu.dswipu;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.widget.Toast;
public class splash extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 5000;
private UserSessionManager session;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getActionBar().hide();
setContentView(R.layout.activity_splash);
Utility ut = new Utility(this);
if(!ut.checkInternet())
{
Toast.makeText(getApplicationContext(), "No internet connection",
Toast.LENGTH_LONG).show();
}
new Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo/company
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
session = new UserSessionManager(getApplicationContext());
if (session.isUserLoggedIn()) {
Intent i = new Intent(getApplicationContext(), Home.class);
startActivity(i);
} else {
Intent i = new Intent(splash.this, Auth.class);
startActivity(i);
}
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
3月16日11:43:47.932 4037から4037/com.dswipu.dswipu E/AndroidRuntimeは:致命的な例外:メイン プロセス:com.dswipu.dswipu、PID:4037 れるjava.lang。 RuntimeException:アクティビティを開始できませんComponentInfo {com.dswipu.dswipu/com.dswipu.dswipu.splash}:android.util.AndroidRuntimeException:コンテンツを追加する前にrequestFeature()を呼び出さなければなりません android.app.ActivityThread.performLaunchActivity ActivityThread.java:2416) android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) android.app.ActivityThread.-wrap11(ActivityThread.java) android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1344) (android.os.Handler.dispatchMessage(Handler.java:102)) android.os.Looper.loop(Looper.java:148) android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(ネイティブメソッド) at com。 android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 原因:android.util。 AndroidRuntimeException:com.dswipu.dswipu.splash.onCreateでrequestFeature()(PhoneWindow.java:317)com.android.internal.policy.PhoneWindow.requestFeatureでコンテンツ を追加する前に呼び出さなければなりません (splash.java:22 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)でandroid.app.Activity.performCreate android.app.Instrumentation.callActivityOnCreateで(Activity.java:6237) (Instrumentation.java:1107) で) android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) android.app.ActivityThread.-wrap11(ActivityThread.java)android.os.Looper.loop(Looper.java:148)の にあるアンドロイド。 android.app.ActivityThread.main(ActivityThread.java:5417)の のjava.lang.reflect.Method.invoke(ネイティブメソッド) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java :726) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 03-16 11:43:47.934 1685-2328/system_process W/ActivityManager:強制終了アクティビティcom.dswipu.dswipu/.splash 03-16 11:43:48.237 1685-2328/system_process I/Wind owManager:Screenshotトークンの最大再試行数4 {2395485 u0 com.dswipu.dswipu/.splash t17 f}} appWin = Window {8f28f3d u0 Starting com.dswipu.dswipu} drawState = 4 03-16 11:43: 48.268 2501-4094/com.google.android.gms D/DropBoxEntryAddedChimeraService:ユーザーが使用&診断にオプトインしていません。 03-16 11:43:48.296 1685-2572/system_process I/OpenGLRenderer:初期化されたEGL、バージョン1.4このエラーを修正する方法 "java.lang.RuntimeException:アクティビティComponentInfoを開始できません"?
どんな説明ですか?どのように問題を知っていると思いますか? –
setContentview(R.layout.lay)の前にrequestFeature()メソッドを呼び出す – Vadivel
私はどのようなコードを用意しますか?私の問題がより良く解決されるのを助けるために..... –