Android Program Launch Failure

I am not totally new to working with the eclipse android plugin but I am new at writing a project from the ground up. So I went to the Android developers website to follow the 'Hello World' tutorial.

When I run my program the emulator puts up a screen that says unfortunately Hello, Android Has stopped working. my code is:

HelloAndroid.Java

package daniel.android.projects;

import android.app.Activity;
import android.os.Bundle;

    public class HelloAndroid extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            Object o = null;
            o.toString();
            setContentView(R.layout.main);
        }
    }

Main.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/textview"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:text="@string/hello"/>

Strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello, Android! I am a string resource!</string>
    <string name="app_name">Hello, Android</string>
</resources>

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="daniel.android.projects"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".AndroidTesterActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Answers


You have a null pointer exception, you assign null to o and then call toString() on it:

Object o = null;
o.toString();

It seems like it serves nothing in your application anyway, it shouldn't be there.

Also, looking at your code, you create HelloAndroid class, but in themanifest you declare

android:name=".AndroidTesterActivity"

it should be

android:name=".HelloAndroid"

Need Your Help

warning LGHT1076 : ICE91: The file 'doc_code_file1' will be installed to the per user directory 'code_Simple'

wix

Eventhough I addded the registry value settings. It gives the following warning

Hadoop - Input path does not exist

eclipse ubuntu hadoop mapreduce

I did set up the hadoop Ubuntu OS, followed all the necessary steps,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.