I get a crash in the load phase of my application. here after the source code:
DiscoveryMain.java
package com.heeere.androiddnssd.discovery;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class DiscoveryMain extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button)this.findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);
}
});
} /** Called when the activity is first created. */
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:fadeScrollbars="true"
android:isScrollContainer="true">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, Android Discovery" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a TextView" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I am a Button" />
</LinearLayout>
</ScrollView>
Manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.heeere.androiddnssd.discovery">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<application>
<activity android:name=".MainTest" android:label="DiscoveryActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
LogCat
09-11 11:21:18.186: W/dalvikvm(3415): threadid=3: thread exiting with uncaught exception (group=0x4001e170)
09-11 11:21:18.196: E/AndroidRuntime(3415): Uncaught handler: thread main exiting due to uncaught exception
09-11 11:21:18.206: E/AndroidRuntime(3415): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.heeere.androiddnssd.discovery/com.heeere.androiddnssd.discovery.MainTest}: java.lang.ClassNotFoundException: com.heeere.androiddnssd.discovery.MainTest in loader dalvik.system.PathClassLoader@44798cd0
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.os.Handler.dispatchMessage(Handler.java:99)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.os.Looper.loop(Looper.java:123)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.app.ActivityThread.main(ActivityThread.java:4363)
09-11 11:21:18.206: E/AndroidRuntime(3415): at java.lang.reflect.Method.invokeNative(Native Method)
09-11 11:21:18.206: E/AndroidRuntime(3415): at java.lang.reflect.Method.invoke(Method.java:521)
09-11 11:21:18.206: E/AndroidRuntime(3415): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-11 11:21:18.206: E/AndroidRuntime(3415): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-11 11:21:18.206: E/AndroidRuntime(3415): at dalvik.system.NativeStart.main(Native Method)
09-11 11:21:18.206: E/AndroidRuntime(3415): Caused by: java.lang.ClassNotFoundException: com.heeere.androiddnssd.discovery.MainTest in loader dalvik.system.PathClassLoader@44798cd0
09-11 11:21:18.206: E/AndroidRuntime(3415): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
09-11 11:21:18.206: E/AndroidRuntime(3415): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
09-11 11:21:18.206: E/AndroidRuntime(3415): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-11 11:21:18.206: E/AndroidRuntime(3415): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
09-11 11:21:18.206: E/AndroidRuntime(3415): ... 11 more
what is the proble in my code ?