xml - Unfortunately, <application name> has stopped. (Android) -
i learning android, trying develop game, have 2 classes "starter" , "board". starter class contains menu(http://postimg.org/image/dnyvoey2l/). exit , buttons working properly, when press "two player" option instead of showing board shows error (unfortunately, (application name) has stopped). sharing code snippet , please suggest solution.
twop.setonclicklistener(new onclicklistener() { public void onclick(view v) { intent tow= new intent(starter.this, selector.class); startactivity(tow); } });
you can't show view
using startactivity()
method
intent tow= new intent(starter.this, board.class); startactivity(tow);
board
should extended activity
not view
class. create boardactivity.java
, extend activity
.
you should add board
view either xml
or programmatically using setcontentview();
in oncreate()
method.
edit
don't forget add new activity
in manifest.xml
file. this
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="your.application.package.name"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".starter" android:label="@string/app_name"></activity> <activity android:name=".selector"></activity> </application> </manifest>
Comments
Post a Comment