ผมเขียนแอพลง Android Force Close แก้ยังไงครับ

ผมทำแอพแบบเปลี่ยน Layout ไปเรื่อยๆพอเขียนเสร็จแล้ว Force Close

Java หน้าแรก
public class MainActivity extends Activity implements OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button b1 = (Button) findViewById(R.id.button1);
        Button b2 = (Button) findViewById(R.id.button2);
        Button b3 = (Button) findViewById(R.id.button3);
        final Intent intent = new Intent(getApplicationContext(),tor.class);
        final Intent intent2 = new Intent(getApplicationContext(),test1.class);
        final AlertDialog.Builder adb = new AlertDialog.Builder(this);
        b1.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(intent);
            }
        });
        b2.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(intent2);
                
            }
        } );
        b3.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                AlertDialog ad = adb.create();
                adb.setMessage("Test ");
                adb.show();
            }
        });
    }

    @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;
    }

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        
    }

}
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่