i'm working java in android studio , trying convert string textview double can used calculate figures on person's income.
the method parsedouble not allow me run in way. i'm wondering why not compile. says cannot resolve method. according documentation, accepts string parameter.
here code currently:
package ericleeconklin.costoflivingcalculator; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import java.lang.object; import android.view.view.onclicklistener; import android.view.view; import android.widget.button; import android.widget.textview; import java.lang.double; public class enterincome extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_enter_income); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_enter_income, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } public void getincome(view income){ view myincomestring; myincomestring = (textview)findviewbyid(r.id.enterincome); double myincome; myincome = double.parsedouble(myincomestring); } }
myincomestring textview have first text ( edittext) , tostring()
change :
public void getincome(view income){ textview myincomestring; myincomestring = (textview)findviewbyid(r.id.enterincome); double myincome; myincome = double.parsedouble(myincomestring.gettext().tostring()); }
Comments
Post a Comment