java - Android basic activity call 2 pages with 1 button respectivly found no erros on validate still won't work in AVD -
can tell me whats wrong?? lost
thanks,mike
p.s.
i figured might work instead of splash 1st page.
page1 or activity 1
package com.test; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; public class test1 extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button next = (button) findviewbyid(r.id.button01); next.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { intent myintent = new intent(view.getcontext(),test2.class); startactivityforresult(myintent, 0); } }); } }
page2 or activity 2
package com.test; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; public class test2 extends activity { /** called when activity first created. */ public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main2); button next = (button) findviewbyid(r.id.button02); next.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { intent intent = new intent(); setresult(result_ok, intent); finish(); } }) ; } }
manifiest
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test" android:versioncode="1" android:versionname="1.0"> <uses-sdk android:minsdkversion="7" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".test1" 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=".activity2"></activity> </application> </manifest>
what wrong posting question on stackoverflow, asking "can tell me whats wrong??", without taking time describe symptoms experiencing. lucky in pretty mood right now.
there @ least 2 problems:
your manifest refers
activity2
not appear existyour activity
test2
not defined in manifest
Comments
Post a Comment