-4

I am trying to make a app for my website. The app is pretty basic, I want the app icon when clicked on from the users phone to go directly to my website. I thought this would be pretty straight forward, however I am having a really tough time finding anything on how to accomplish this. I have found a tutorial on http://developer.android.com/guide/webapps/webview.html and I actually implemented this and it works. However I do not want it to go to webview. I would like it to go straight to the native phone browser when clicked. Could somebody explain in detail how to accomplish this please.

Dewayne Phillips
  • 29
  • 1
  • 2
  • 8

1 Answers1

-1

For sake of answer but should not make this kind of application.

First of all create an android project, in that create an android xml file in layout folder.

name it mywebview.xml. and remove all code and paste given below code.

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

then create an activity for example given below in your src folder

 public class ExampleActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            WebView myWebView = (WebView) findViewById(R.id.webview);
           myWebView.loadUrl("your url");
        }
        @Override
        protected void onStart() {
            super.onStart();
            // The activity is about to become visible.
        }
        @Override
        protected void onResume() {
            super.onResume();
            // The activity has become visible (it is now "resumed").
        }
        @Override
        protected void onPause() {
            super.onPause();
            // Another activity is taking focus (this activity is about to be "paused").
        }
        @Override
        protected void onStop() {
            super.onStop();
            // The activity is no longer visible (it is now "stopped")
        }
        @Override
        protected void onDestroy() {
            super.onDestroy();
            // The activity is about to be destroyed.
        }
    }

in your android manifest remove all activity and add

<activity android:name=".ExampleActivity" android:icon="@drawable/app_icon">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

 <uses-permission android:name="android.permission.INTERNET" />

then add uses permission in android manifest file.

Piyush
  • 1,973
  • 1
  • 19
  • 30