0
I tried to pass numbers that would be inserted in 3 editTexts for 3 variables long that I created: l01, l02, l03
. To that way work them and make a very simple account.
Mainactivity.java:
package genesysgeneration.treerule;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
public class MainMenuActivity extends AppCompatActivity {
private EditText et01, et02, et03;
private TextView tv01;
private long l01, l02, l03;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
l01=0;
l02=0;
l03=0;
et01=(EditText)findViewById(R.id.et01);
et02=(EditText)findViewById(R.id.et02);
et03=(EditText)findViewById(R.id.et03);
l01=et01;
l02=et02;
l03=et03;
tv01=(TextView)findViewById(R.id.tv01);
tv01.setText(l01*l02*l03);
}
}
I also changed the 3 inputType from the 3 editTexts to number|numberDecimal:
What did I do wrong, or what did I fail to do? The program did not even run errors in the following lines:
l01=et01;
l02=et02;
l03=et03;
tv01.setText(l01*l02*l03);
The last line error is gone, thank you! However it still gives error in the lines where I put for the variables (L01, L02, L03) receive the values of editTexts.
– Boneco Sinforoso
Sorry, I hadn’t noticed that there was more error in the code. I edited the answer with the rest of the code.
– Leonardo Cesar Teixeira
It went bad here. Look what happened: "close() was Never explicitly called on database '/data/data/com.google.android.gms/Databases/networkstatistics.sqlite' android.database.sqlite.Databaseobjectnotclosedexception: Application did not close the cursor or database object that was opened here" e mais "java.lang.RuntimeException: Unable to start activity ComponentInfo{genesysgeneration.treerule/genesysgeneration.treerule.MainMenuActivity}: java.lang.NumberFormatException: Invalid long: """
– Boneco Sinforoso