I tried opening a url following some others questions, but the onClick event just restart the app and its not opening the browser. Thx for the help
UPDATE: This works for activities not for fragments.
this is my .xml button
<ImageButton
android:layout_width="55dp"
android:layout_height="55dp"
android:id="@+id/imageButton2"
android:background="@drawable/icon"
android:layout_margin="5dp"
android:layout_weight="1"
android:onClick="EnterButton"/>
This is my .java with the implemented method.
public void EnterButton(View view) {
Uri uri = Uri.parse("http://www.google.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}