何が原因なのかわかりません - 私はフラグメントを使用していますが、いくつかの機会に戻るボタンを上書きしますが、ハプニング。アプリケーションの起動後に初めて起動したときに画面が白く表示されるアプリケーション
私はlogcatをチェックしましたが、なぜこれが起こっているのかを示すノートは何もありません。何が問題なのか、何を確認するのでしょうか?
onDestroyに手動での呼び出しはありません。
問題が発生したら、ライフサイクルの早い段階でこれが起こり、インストール時にアプリが正常に読み込まれていることを確認してから、アプリにログインしてアプリを終了すると読み込めませんもう一度、次のように白い画面が表示されます。
Androidのマニフェスト
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.year3.practise">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity
public class MainActivity extends AppCompatActivity {
private SharedPreferences pref;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pref = getPreferences(0);
//initialise method
initFragment();
}
private void initFragment(){
Fragment fragment;
if(pref.getBoolean(Constants.IS_LOGGED_IN,false)){
fragment = new ProfileFragment();
}
else {
fragment = new QuestionPinFragment();
// update the main content by replacing fragments
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.fragment_frame, fragment)
.commit();
}
}
}
はあなたのAndroidManifest.xmlとあなたのMainActivityコードを投稿してください –
@JuanCruzSoler、私は両方を追加した - 支援しようとに感謝を。 –