Nitrosolid
Lurker
Ok im beginner and i wanted to see put an image button on my app.When i put it and run it in eclipse it say "Unfortunately,About me App has stopped."
Here is my code
XML
Manifest
Can you guys help me out?
Here is my code
PHP:
package com.example.aboutmeapp;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
public class Main extends Activity {
Button next;
Button count;
Button exit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
next=(Button)findViewById(R.id.Btn1);
count=(Button)findViewById(R.id.count);
exit=(Button)findViewById(R.id.Exit);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent n = new Intent(Main.this,About.class);
startActivity(n);
}
});
count.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent a = new Intent(Main.this,Startingpoint.class);
startActivity(a);
}
});
exit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
}
@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;
}
}
PHP:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#3EB6E6"
android:gravity="center"
android:orientation="vertical" >
<Button
android:id="@+id/Btn1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="About Me" />
<Button
android:id="@+id/count"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Counter" />
<ImageButton
android:id="@+id/Exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/a1" />
</LinearLayout>
PHP:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aboutmeapp"
android:versionCode="1"
android:versionName="1.0" >
<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.example.aboutmeapp.Main"
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/app_name" >
</activity>
<activity
android:name=".Startingpoint"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
Can you guys help me out?