Hello i have a problem with running the application, when ill run it, its opening but when i will press the button saying me that the application is stopped and cant run: “Unfortunately, App has Stopped”. Here is my simple code and i hope i will get the answer fast... Thanks allot :)
package com.stefan.stefan1;
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 MainActivity extends Activity {
TextView textView1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView1.setText("Hello Im Stefan !");
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Hello again i have new problem i have added another label(textView2) and im trying to add again this line textView2 = (TextView) findViewById(R.id.textView2); but giving me error for adding something in class "R.java" please help .. :/