Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Application Force Close error
    text
    copied!<p>I wrote the following code and compiled it but when I run the application, I get the error <strong>android the application has stopped unexpectedly force close eclipse</strong>. I thought this is because I didn't initialize the Button and TextView objects but when I initialize them, I get missing token ";" error. What is the reason for this error.</p> <pre><code>package com.umer.first.project; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class StartingPoint extends Activity { int counter; TextView display; Button add, sub; //add= new Button(this); //sub=new Button(this); //display=new TextView(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_starting_point); add= (Button) findViewById(R.id.aButton); sub = (Button) findViewById(R.id.sButton); display= (Button) findViewById(R.id.tvButton); add.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub counter++; display.setText("The total is " + counter); } }); sub.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub counter--; display.setText("You counter is " + counter); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_starting_point, menu); return true; } } </code></pre>
 

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