android app showing error (unfortunately,Sudoku has stopped)



hello i am learning android from book hello,android and i am stuck in chapter 3 . I am trying to show a new activity containing information about Sudoku game when user click the about button but dwe to a some reason when i ran the app it shows me unfortunately,Sudoku has stopped.I tried to solve by myself but unable to figure out the problem .I need your hellllllllllp

here the files are listed below


AndroidManifest.xml



<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.android.sudoku.Sudoku"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".About"
android:label="@string/about_title">
</activity>

</application>


about.xml



<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
>

<TextView
android:id="@+id/about_content"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/about_text"/>

</ScrollView>


activity_sudoku.xml(my main activity)



<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:background="@color/background"
android:padding="30dip" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dip"
android:text="@string/main_title"
android:textSize="24.5sp" />

<Button
android:id="@+id/continue_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/continue_label" />

<Button
android:id="@+id/meow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_label" />

<Button
android:id="@+id/about_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_label" />

<Button
android:id="@+id/exit_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_label" />

<Button
android:id="@+id/ext_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_label" />

</LinearLayout>


Sudoku.java



package com.android.sudoku;

//import android.support.v7.app.ActionBarActivity;
//import android.support.v7.app.ActionBar;
//import android.support.v4.app.Fragment;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.os.Bundle;
//import android.view.LayoutInflater;
//import android.view.Menu;
//import android.view.MenuItem;
import android.app.Activity;
//import android.view.View;
//import android.view.ViewGroup;
//import android.os.Build;

public class Sudoku extends Activity implements OnClickListener{

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sudoku);

// setup click listeners for all the button
View continueButton = findViewById(R.id.continue_button);
continueButton.setOnClickListener(this);

View newButton = findViewById(R.id.new_button);
newButton.setOnClickListener(this);
System.out.print("here ");
View aboutButton = findViewById(R.id.about_button);
aboutButton.setOnClickListener(this);
System.out.println("no error");
View exitButton = findViewById(R.id.exit_button);
exitButton.setOnClickListener(this);

View dialogButton = findViewById(R.id.ext_button);
dialogButton.setOnClickListener(this);

if (savedInstanceState == null) {

}
}


public void onClick(View v) {

switch(v.getId()) {

case R.id.about_button:
Intent i = new Intent(this,About.class);
startActivity(i);
break;
// more buttons go here id any
}

}

}


About.java



package com.android.sudoku;
import android.app.Activity;
import android.os.Bundle;
public class About extends Activity {
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.about);
}
}

No comments:

Post a Comment