0

How to divide int by 3.5

I have a code that's giving me trouble button.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(view v) { String strinput = editText.getText ().toString (); int final_value = Integer.parseInt (strinput); edittext.setText (final_value / 3.5 ); } }}; } } I know it won't accept a double but I need to find a way to make it work. I need to take an int from editText divide it by a final double and display it to textview. for an example.

26th Apr 2018, 7:23 AM
Shon Gosnell
+ 1
26th Apr 2018, 7:47 AM
Timon Paßlick
+ 1
Both int: No, it's going to be rounded to the lower whole number. At least one must be float.
26th Apr 2018, 6:21 PM
Timon Paßlick
+ 1
I think it should work all automatic. But I don't know your graphics library. It's very probable, try it out.
26th Apr 2018, 6:55 PM
Timon Paßlick
+ 1
27th Apr 2018, 4:09 AM
Timon Paßlick
+ 1
Yes, but it requires JNI -> complicated
27th Apr 2018, 4:38 AM
Timon Paßlick
0
Will it work as both integers and also work as both doubles?
26th Apr 2018, 5:55 PM
Shon Gosnell
0
so I can have final_value be a integer and 3.5 be a float? and the integer has to be user input from edittext
26th Apr 2018, 6:24 PM
Shon Gosnell
0
what if the user inputs 3 or even 4 digits? should I just make a separate button for each digit? or can I make it all automatic
26th Apr 2018, 6:31 PM
Shon Gosnell
0
(x<<1)//7
26th Apr 2018, 8:52 PM
VcC
0
when I cast integer to double it says double can't be applied to int. I'm using java
26th Apr 2018, 10:21 PM
Shon Gosnell
0
could c++ be used inside of java
27th Apr 2018, 4:37 AM
Shon Gosnell