Tobias Eisentraeger wrote:
> 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
<snip>
> 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)
Look at line 43 of EditYourSettingActivity -- it should be in onCreate()
-- and figure out why you are trying to use a null pointer.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android Development Wiki: http://wiki.andmob.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---