android - FATAL Exception:java.lang.RuntimeException: Unable to start activity ComponentInfo -
i try solve problem don't find solution please me solve it. 1)my package.java file:
b_indian=(button)findviewbyid(r.id.b_indian); b_classic=(button)findviewbyid(r.id.b_classic); b_royal=(button)findviewbyid(r.id.b_royal); t_pkg=(textview)findviewbyid(r.id.t_pkg); t_indian=(textview)findviewbyid(r.id.t_indian); t_classic=(textview)findviewbyid(r.id.t_classic); t_royal=(textview)findviewbyid(r.id.t_royal); b_indian.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(package.this,indianpkg.class); startactivity(i); } }); b_classic.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(package.this,classicpkg.class); startactivity(i); } }); b_royal.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(package.this,royalpkg.class); startactivity(i); } }); } }
2)activity_package.xml
<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="package" android:id="@+id/t_pkg" android:layout_gravity="center_horizontal" style="@style/title"/> <tablelayout android:layout_width="match_parent" android:layout_height="match_parent"> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_indian" android:textsize="18sp" android:gravity="center" android:singleline="false" android:paddingbottom="10dp" android:layout_margin="25dp"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="indian" android:id="@+id/t_indian" android:layout_margin="55dp" android:gravity="center_horizontal" style="@style/simpletext"/> </relativelayout> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_classic" android:textsize="18sp" android:gravity="center" android:singleline="false" android:paddingbottom="10dp" android:layout_margin="25dp" /> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="classic" android:layout_margin="50dp" android:id="@+id/t_classic" android:layout_gravity="center_horizontal" style="@style/simpletext"/> </relativelayout> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_royal" android:textsize="18sp" android:gravity="center" android:singleline="false" android:paddingbottom="10dp" android:layout_margin="25dp"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="royal" android:layout_margin="55dp" android:id="@+id/t_royal" android:layout_gravity="center_horizontal" style="@style/simpletext"/> </relativelayout> </tablerow> </tablelayout>
this package file , put same code intent 3 different packages in file intent indian package , rest of 2 packages not intent , have error:fatal exception. following files: 1)indianpkg.java
b_i_venue=(button)findviewbyid(r.id.b_i_venue); b_i_decor=(button)findviewbyid(r.id.b_i_decor); b_i_caterer=(button)findviewbyid(r.id.b_i_caterer); b_i_photo=(button)findviewbyid(r.id.b_i_photo); b_i_mehandi=(button)findviewbyid(r.id.b_i_mehandi); b_i_dj=(button)findviewbyid(r.id.b_i_dj); t1=(textview)findviewbyid(r.id.t1); b_i_venue.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(indianpkg.this,indian_venue.class); startactivity(i); } }); b_i_decor.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(indianpkg.this,indian_decoration.class); startactivity(i); } }); b_i_caterer.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(indianpkg.this,indian_decoration.class); startactivity(i); } }); b_i_photo.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(indianpkg.this,indian_caterer.class); startactivity(i); } }); b_i_mehandi.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(indianpkg.this,indian_mehandi.class); startactivity(i); } }); b_i_dj.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(indianpkg.this,indian_dj.class); startactivity(i); } }); } }
2)activity_indianpkg.xml
<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text=" indian wedding" android:id="@+id/t1" android:layout_gravity="center_horizontal" style="@style/title"/> <tablelayout android:layout_width="match_parent" android:layout_height="match_parent"> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_i_venue" android:background="@drawable/i_venue" android:text="venue" android:textsize="18sp" android:gravity="center|bottom" android:singleline="false" android:paddingbottom="10dp" android:layout_margin="10dp" style="@style/title"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_i_decor" android:background="@drawable/i_decoration" android:text="decoration" android:textsize="18sp" android:gravity="center|bottom" android:singleline="false" android:paddingbottom="10dp" android:layout_margin="10dp" style="@style/title"/> </relativelayout> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_i_caterer" android:text="caterer" android:background="@drawable/i_caterer" android:textsize="18sp" android:gravity="center|bottom" android:layout_margin="10dp" android:paddingbottom="10dp" style="@style/title"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_i_photo" android:text="photography" android:background="@drawable/i_photography" android:textsize="18sp" android:gravity="center|bottom" android:paddingbottom="10dp" android:layout_margin="10dp" style="@style/title"/> </relativelayout> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_i_mehandi" android:text="mehandi" android:background="@drawable/i_mahendi" android:textsize="18sp" android:gravity="center|bottom" android:layout_margin="10dp" android:paddingbottom="10dp" style="@style/title"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_i_dj" android:text="dj" android:background="@drawable/i_dj" android:textsize="18sp" android:gravity="center|bottom" android:layout_margin="10dp" style="@style/title" android:paddingbottom="10dp"/> </relativelayout> </tablerow> </tablelayout>
above code run succesfully. below code same still not run , give fatal exception.
3)classic.java
b_c_venue=(button)findviewbyid(r.id.b_i_venue); b_c_decor=(button)findviewbyid(r.id.b_i_decor); b_c_caterer=(button)findviewbyid(r.id.b_i_caterer); b_c_photo=(button)findviewbyid(r.id.b_i_photo); b_c_mehandi=(button)findviewbyid(r.id.b_i_mehandi); b_c_dj=(button)findviewbyid(r.id.b_i_dj); t2=(textview)findviewbyid(r.id.t2); b_c_venue.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(classicpkg.this,classic_venue.class); startactivity(i); } }); b_c_decor.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(classicpkg.this,classic_decoration.class); startactivity(i); } }); b_c_caterer.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(classicpkg.this,classic_caterer.class); startactivity(i); } }); b_c_photo.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(classicpkg.this,classic_photography.class); startactivity(i); } }); b_c_mehandi.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(classicpkg.this,classic_mehandi.class); startactivity(i); } }); b_c_dj.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent i=new intent(classicpkg.this,classic_dj.class); startactivity(i); } }); } }
4)activity_classic.xml
<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text=" classic wedding" android:id="@+id/t2" android:layout_gravity="center_horizontal" style="@style/title"/> <tablelayout android:layout_width="match_parent" android:layout_height="match_parent"> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_c_venue" android:background="@drawable/i_venue" android:text="venue" android:textsize="18sp" android:gravity="center|bottom" android:singleline="false" android:paddingbottom="10dp" android:layout_margin="10dp" style="@style/title"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_c_decor" android:background="@drawable/i_decoration" android:text="decoration" android:textsize="18sp" android:gravity="center|bottom" android:singleline="false" android:paddingbottom="10dp" android:layout_margin="10dp" style="@style/title"/> </relativelayout> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_c_caterer" android:text="caterer" android:background="@drawable/i_caterer" android:textsize="18sp" android:gravity="center|bottom" android:layout_margin="10dp" android:paddingbottom="10dp" style="@style/title"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_c_photo" android:text="photography" android:background="@drawable/i_photography" android:textsize="18sp" android:gravity="center|bottom" android:paddingbottom="10dp" android:layout_margin="10dp" style="@style/title"/> </relativelayout> </tablerow> <tablerow android:layout_width="fill_parent" android:layout_height="0dp" android:weightsum="1" android:layout_weight="0.5"> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_c_mehandi" android:text="mehandi" android:background="@drawable/i_mahendi" android:textsize="18sp" android:gravity="center|bottom" android:layout_margin="10dp" android:paddingbottom="10dp" style="@style/title"/> </relativelayout> <relativelayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5"> <button android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/b_c_dj" android:text="dj" android:background="@drawable/i_dj" android:textsize="18sp" android:gravity="center|bottom" android:layout_margin="10dp" style="@style/title" android:paddingbottom="10dp"/> </relativelayout> </tablerow> </tablelayout>
may haven't add activity class in androidmaifest.xml
if don't!
add activity androidmaifest.xml
like this
<activity android:name=".classic" android:label="your_activity_label"> </activity>
then edit code in classic.java
b_c_venue=(button)findviewbyid(r.id.b_c_venue); b_c_decor=(button)findviewbyid(r.id.b_c_decor); b_c_caterer=(button)findviewbyid(r.id.b_c_caterer); b_c_photo=(button)findviewbyid(r.id.b_c_photo); b_c_mehandi=(button)findviewbyid(r.id.b_c_mehandi); b_c_dj=(button)findviewbyid(r.id.b_c_dj); t2=(textview)findviewbyid(r.id.t2);
Comments
Post a Comment