mikred11 0 Newbie Poster
package com.hummingbird.mik;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class chapters extends Activity {
	MediaPlayer sButton;
	Intent intent1;
	private Button c1;
	private Button c2;
	private Button c3;
	private Button c4;
	
		
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.chapterlist);
		setView();
		sButton = MediaPlayer.create(this, R.raw.page3);
	}

	
	private void setView() {
		c1 = (Button)findViewById(R.id.chap1);
		c2 = (Button)findViewById(R.id.chap2);
		c3 = (Button)findViewById(R.id.chap3);
		c4 = (Button)findViewById(R.id.chap4);
		
		c1.setOnClickListener(new View.OnClickListener() {
		
			@Override
			public void onClick(View v) {
				intent1 = new Intent(chapters.this, chapter1.class);
				startActivity(intent1);
				sButton.start();
			}
		}); 
		
		c2.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				intent1 = new Intent(chapters.this, chapter2.class);
				startActivity(intent1);
				
			}
		});
		
		c3.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				intent1 = new Intent(chapters.this, chapter3.class);
				startActivity(intent1);
				
			}
		});
		
		c4.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				intent1 = new Intent(chapters.this, chapter4.class);
				startActivity(intent1);
				
			}
		});
	}
}

the problem is when i click the chapter 1 button it works find it take me to another layout that i made but when i click chapter 2 and 3 , 4 an error pops out like this saying: "the application com.hummingbird.mik (process com.hummingbird.mik) has stopped unexpectedly. please try again.."
http://www.daniweb.com/forums/attachment.php?attachmentid=21631&stc=1&d=1310690109

Please Help i've been dealing with this for a day now i can't fix it i'm just trying to learn..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.