KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Ive got a problem. I want to open an Activity with a Button but it crashes all the time. So I created 2 Classes and A Button. But it keeps crashing. Class is activity_home class() and second is schedule_act() class. activity_home class: package my.action.bat; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class activity_home extends Activity { private Button ScheduleBtn; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); ScheduleBtn = (Button) findViewById(R.id.home_btn_schedule); ScheduleBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent myIntent = new Intent("my.action.bat.schedule_act"); startActivity(myIntent); } }); } } schedule_act class: package my.action.bat; import android.app.Activity; import android.os.Bundle; public class schedule_act extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.schedule_layout); } } Android Manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my.action.bat" android:versionCode="1" android:versionName="1.0" >
Tags (comma-separated)
Save Edits
Cancel