I am getting Null Pointer Exception in button.setOnClickListener why i don't know. i just check all xml file and other stuff but still getting any one can please resolve my problem.
Thanks in Advance.
public class StartingPoint extends Activity implements View.OnClickListener{
Button bLearn_Basic_C_Programs;
Button bC_Programs;
Button bMoreApps;
String thepixelmakerWebSiteAddress ="";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.c_programs_start);
bLearn_Basic_C_Programs = (Button)findViewById(R.id.bLearn_Basic_C_Programs);
bC_Programs = (Button) findViewById(R.id.bC_Programs);
bMoreApps = (Button) findViewById(R.id.bMoreApps);
Log.d("here", "first");
// i getting exception here
bLearn_Basic_C_Programs.setOnClickListener(this);
Log.d("here", "second");
bC_Programs.setOnClickListener(this);
bMoreApps.setOnClickListener(this);
}
public void onClick(View view) {
switch(view.getId()){
case R.id.bLearn_Basic_C_Programs:
Intent intent1 = new Intent(StartingPoint.this, Learn_Basic_C_Programs_Start.class);
this.startActivity(intent1);
break;
case R.id.bC_Programs:
Intent intent2 = new Intent(StartingPoint.this, C_Programs_Start_1_50.class);
this.startActivity(intent2);
break;
case R.id.bMoreApps:
Intent intenMoreApps = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(thepixelmakerWebSiteAddress));
startActivity(intenMoreApps);
break;
}
}
}