Hello, I have trouble launching the WebBrowser with an Intent with a Button Click. I try doing this in the onCreate Method of my Activity:
final Button getTheButtonBtn = (Button) this.findViewById(R.id.ButtonTheButton); getTheButtonBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { // Browser oeffnen mit url Intent i = new Intent(Intent.ACTION_VIEW , Uri.parse(" http://www.url.com) ); startActivity(i); } }); Its in the View like this: <Button android:text="@string/button_ButtonTheButton_hint" android:id="@+id/ButtonTheButton" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> When i launch the Activity i get a force close with this in the log: 08-22 12:47:35.832: ERROR/AndroidRuntime(1826): Uncaught handler: thread main exiting due to uncaught exception 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.APPName/com.mycompany.APPName.EditYourSettingActivity}: java.lang.NullPointerException 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.os.Handler.dispatchMessage(Handler.java:99) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.os.Looper.loop(Looper.java:123) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.app.ActivityThread.main(ActivityThread.java:3948) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at java.lang.reflect.Method.invokeNative(Native Method) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at java.lang.reflect.Method.invoke(Method.java:521) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at dalvik.system.NativeStart.main(Native Method) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): Caused by: java.lang.NullPointerException 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at com.mycompany.APPName.EditYourSettingActivity.onCreate(EditYourSettingActivity.java:43) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 08-22 12:47:35.942: ERROR/AndroidRuntime(1826): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231) Any Ideas what I do wrong? Thanks so much, Toby --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---