java - When I press back on my program i get a blank screen -
after getting chapter3_1.xml page pulls fine when press phones key , takes me previous button. press 1 time again , there's blank page isn't supposed there. press 1 time again , original button. no errors no crashes.
manifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.th3ramr0d.ar670_1quickreference" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="14" android:targetsdkversion="21" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainmenu" 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=".submenu1" android:label="@string/app_name" > <intent-filter> <action android:name="com.th3ramr0d.ar670_1quickreference.submenu1" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name=".chapter3" android:label="@string/app_name" > <intent-filter> <action android:name="com.th3ramr0d.ar670_1quickreference.chapter3" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name=".chapter3_1" android:label="@string/app_name" > <intent-filter> <action android:name="com.th3ramr0d.ar670_1quickreference.chapter3_1" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> </application> </manifest>
mainmenu.java
bundle com.th3ramr0d.ar670_1quickreference; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; public class mainmenu extends activity{ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button btnchpt3 = (button) findviewbyid(r.id.btnchpt3); btnchpt3.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub startactivity(new intent("com.th3ramr0d.ar670_1quickreference.chapter3")); } }); } }
submenu1.java
bundle com.th3ramr0d.ar670_1quickreference; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; public class submenu1 extends activity{ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.chapter3); button btnchpt3 = (button) findviewbyid(r.id.btnchpt3_1); btnchpt3.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub startactivity(new intent("com.th3ramr0d.ar670_1quickreference.chapter3_1")); } }); } }
chapter3.java
bundle com.th3ramr0d.ar670_1quickreference; import android.app.activity; import android.content.intent; import android.os.bundle; public class chapter3 extends activity{ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); startactivity(new intent("com.th3ramr0d.ar670_1quickreference.submenu1")); } }
chapter3_1.java
bundle com.th3ramr0d.ar670_1quickreference; import android.app.activity; import android.os.bundle; public class chapter3_1 extends activity{ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.chapter3_1); } }
activity_main.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.th3ramr0d.ar670_1quickreference.mainactivity" > <button android:id="@+id/btnchpt3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="chapter 3" /> </linearlayout>
chapter3.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <button android:id="@+id/btnchpt3_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="fuckmylife" /> </linearlayout>
chapter3_1.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="this content of chapter 3_1" android:textappearance="?android:attr/textappearancelarge" /> </linearlayout>
i think using fragment in application. , when pushing fragment you'r adding stack thats why when press button show blank screen framelayout on showing fragment view. refer link :-
fragmnet manager
java android
No comments:
Post a Comment