android - Activity SetContentView ResourcesNotFound Exception -
first of before wrote question had done search lot in website no solution found. problem title says; just 1 activity in program, activity cant find resources.. other it, every activity can find , works fine. tried everything; "clean , rebuild" ,"switch workspace" , adding "com.myapp.r" top of activity, redownload or close/reopen eclipse" , many more.. checked bug happens in menu folder in "main.xml" ">" instead "/>" anyway.... please find solution. thanks
this activity;
import java.text.decimalformat; import java.text.decimalformatsymbols; import android.app.activity; import android.app.alertdialog; import android.content.dialoginterface; import android.content.pm.activityinfo; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class calculator extends activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.calculator); setrequestedorientation(activityinfo.screen_orientation_landscape); final decimalformat df = new decimalformat("0.00000", decimalformatsymbols.getinstance()); decimalformatsymbols symbols = new decimalformatsymbols(); symbols.setdecimalseparator('.'); df.setdecimalformatsymbols(symbols); final edittext et = (edittext) findviewbyid(r.id.calc_me); final edittext et2 = (edittext) findviewbyid(r.id.calc_me2); button copy = (button) findviewbyid(r.id.buttoncopy); final textview tv = (textview) findviewbyid(r.id.calc_res); copy.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub if(tv.gettext().tostring().length() >=9) { string s = tv.gettext().tostring(); s = s.substring(8,s.length()); et.settext(s); } } });
this layout if needed
<?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchcolumns="*"> <tablerow android:layout_weight="1"> <edittext android:id="@+id/calc_me" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:textsize="20sp" android:inputtype="numbersigned|numberdecimal" /> <edittext android:id="@+id/calc_me2" android:layout_width="match_parent" android:layout_weight="1" android:layout_height="wrap_content" android:textsize="20sp" android:inputtype="numbersigned|numberdecimal" /> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <textview android:id="@+id/calc_res" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginleft="3dp" android:layout_weight="2" android:textsize="20sp" android:text="result: "/> <button android:layout_height="wrap_content" android:id="@+id/buttoncopy" android:text="copy" android:layout_width="fill_parent"/> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <button android:layout_height="wrap_content" android:id="@+id/buttonsquare" android:text="√" android:layout_width="fill_parent"/> <button android:layout_height="wrap_content" android:id="@+id/buttonpower" android:text="^" android:layout_width="fill_parent"/> <button android:layout_height="wrap_content" android:id="@+id/buttonpi" android:text="π" android:layout_width="fill_parent"/> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <button android:layout_height="wrap_content" android:id="@+id/buttonsin" android:text="sin" android:layout_weight="1" android:layout_width="fill_parent"/> <button android:layout_height="wrap_content" android:id="@+id/buttoncos" android:text="cos" android:layout_weight="1" android:layout_width="fill_parent"/> <button android:layout_height="wrap_content" android:id="@+id/buttontan" android:text="tan" android:layout_weight="1" android:layout_width="fill_parent"/> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <button android:layout_height="wrap_content" android:id="@+id/buttonplus" android:text="+" android:layout_width="fill_parent"/> <button android:layout_height="wrap_content" android:id="@+id/buttonminus" android:text="-" android:layout_width="fill_parent"/> <button android:layout_height="wrap_content" android:id="@+id/buttontimes" android:text="*" android:layout_width="fill_parent"/> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/buttonlog" android:text="logb10"/> <button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/buttone" android:text="e"/> <button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/buttondivide" android:text="/"/> </tablerow> </tablelayout>
hey put line in xml file.actually problem xml file.
<tablelayout 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:stretchcolumns="*" >
tested me work perfect.if helpful accept.
Comments
Post a Comment