While i'm debugging the code it shows no errors ... but while running the app it shows "Unfortunately app has stopped".this is my Activity 2 page... from this page while clicking next button it should move to Activity 3 page.this is my Activity 2 page
package com.example.admin.androidapp;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;
public class Activity2 extends Activity {
Button btn11;
Button btn22;
public Intent intent;
Button btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity2);
btn11 = (Button) findViewById(R.id.button2);
btn22 = (Button) findViewById(R.id.button5);
btn = (Button) findViewById(R.id.button2);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button2:
intent = new Intent(Activity2.this, Activity3.class);
startActivity(intent);
break;
case R.id.button5:
intent= new Intent(Activity2.this, Welcome.class);
startActivity(intent);
break;
}
}
});
}
}
===============================================================
here is my Activity3 page:
package com.example.admin.androidapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
public class Activity3 extends Activity{
RadioGroup radiogroup;
Button btn1;
private Intent mIntent;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity3);
radiogroup = (RadioGroup) findViewById(R.id.radiogroup);
btn1 = (Button) findViewById(R.id.button);
radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int RadioID) {
RadioButton rd = (RadioButton) radioGroup.findViewById(RadioID);
switch (rd.getId()) {
case R.id.radioButton7:
mIntent = new Intent(Activity3.this, Terminate.class);
break;
case R.id.radioButton8:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton10:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton11:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton15:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton16:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton17:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton18:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton19:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton13:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton12:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
case R.id.radioButton14:
mIntent = new Intent(Activity3.this, Activity4.class);
break;
}
}
}
========================================== Please check the above code and help me in this issue.. Thanks in advance. and im getting this message in logcat while click button like java.lang.NullPointerException: Attempt to invoke virtual method