Note that there are some explanatory texts on larger screens.

plurals
  1. POJava - Android SDK - Unfrotunately <project name> has crashed error
    primarykey
    data
    text
    <p>I Have been working on a small app, which can calculate complex numbers for me (division, subtraction, multiplying etc.). I have no apparent compile errors, but when i run the program I get a bunch of run-time errors which I can't understand or know how to fix. Am i missing something obvious? This is my code: </p> <pre><code> package complex.OliverV; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.RadioButton; import android.widget.EditText; public class ComplexNumbersActivity extends Activity { Button Check; RadioButton plus, minus, multiply, div; EditText X1,X2,Y1,Y2; TextView Ans; int sign; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Check = (Button) findViewById(R.id.Check); plus = (RadioButton) findViewById(R.id.plus); minus = (RadioButton) findViewById(R.id.minus); multiply = (RadioButton) findViewById(R.id.multiply); div = (RadioButton) findViewById(R.id.div); Ans = (TextView) findViewById(R.id.Ans); plus.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub sign=1; } }); minus.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub sign=2; } }); multiply.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub sign=3; } }); div.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub sign=4; } }); Check.setOnClickListener(new View.OnClickListener(){ String xs=X1.getText().toString(); String xss=X2.getText().toString(); String ys=Y1.getText().toString(); String yss=Y2.getText().toString(); double x3,y3; @Override public void onClick(View v) { // TODO Auto-generated method stub if(xs!="" &amp;&amp; xss!="" &amp;&amp; ys!="" &amp;&amp; yss!="") { double x1=Double.parseDouble(xs); double x2=Double.parseDouble(xss); double y1=Double.parseDouble(ys); double y2=Double.parseDouble(yss); switch(sign) { case(1): { x3=x1+x2; y3=y1+y2; } case(2): { x3=x1-x2; y3=y1-y2; } case(3): { x3=(x1*x2-y1*y2); y3=(x2*y1 + x1*y2); } case(4): { if(x2!=0 &amp;&amp; y2!=0) { x3 = (x1 * x2 + y1 * y2) / (x2 * x2 + y2 * y2); y3 = (x2 * y1 - x1 * y2) / (x2 * x2 + y2 * y2); } else { Ans.setText("Enter valid numbers!"); } } } Ans.setText("x="+x3+"y="+y3); } else { Ans.setText("Enter valid numbers!"); } } }); } } </code></pre> <p>I am also adding a screenshot of the errors I get.<img src="https://i.stack.imgur.com/Jlxq8.png" alt="Errors"> Im putting an image, because copying the text looks like a mess. Sorry for the long question and thank you to anyone who can take the time to help me out, I am very grateful for every bit of help. :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload