Reputation: 10247
When I comment out the line setting the button's OnClickHandler, the widgets in the Activity display fine; when that line is not commented out, though, all that displays is the project name in the strip at the top. ???
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class OnDemandAndAutomatic_Activity extends Activity implements View.OnClickListener {
Button buttonAuthorizeUsers;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ondemandandautomatic_activity);
buttonAuthorizeUsers = (Button) findViewById(R.id.buttonAuthorizeUsers);
//buttonAuthorizeUsers.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent configure = new Intent(OnDemandAndAutomatic_Activity.this, Configure_Activity.class);
OnDemandAndAutomatic_Activity.this.startActivity(configure);
}
}
Upvotes: 0
Views: 58
Reputation: 33741
It's not the button click that's making the crash. Since setting the listener is what causes the crash, then buttonAuthorizeUsers
must be null and if you call methods on a null object, you'll get a crash.
Upvotes: 1