0

How to get numbers from edittext for operator

I have the code button.setOnClickListener(new view.onclicklistener() { @Override public void onclick (View v) { String valuetwo = edittext.gettext ().tostring (); not finalvalue = Integer.parseint (valuetwo); textview6.settext (valuetwo / valueone+""); } }}; } I get the error operator / cannot be applied to java.lang.string and double. I have valueone declared final double valueone = 3.5; can anyone help me?

26th Apr 2018, 4:28 AM
Shon Gosnell
Shon Gosnell - avatar
4 Antworten
0
not finalvalue should say int finalvalue =Integer.parseint (valuetwo);
26th Apr 2018, 4:29 AM
Shon Gosnell
Shon Gosnell - avatar
0
hello, valuetwo is a string - you parse it into finalvalue but never use final value. You need to do ( (finalvalue/valueone)+"")
26th Apr 2018, 4:50 AM
Shannon
Shannon - avatar
0
works great! thank you
26th Apr 2018, 4:59 AM
Shon Gosnell
Shon Gosnell - avatar
0
you're welcome :)
26th Apr 2018, 1:45 PM
Shannon
Shannon - avatar