alex
alex

Reputation: 1

Open up a website on Android

I want my Android app to open wikipedia.com as soon as the icon is pressed. I've set up everything correctly, it's just a programming problem. This is what I have so far in my src folder:

package com.wikipedia.lewicki;

import android.app.Activity;
import android.os.Bundle;

public class WikipediaMobile extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

I want to open the www.wikipedia.com home page.

Upvotes: 0

Views: 630

Answers (2)

Piyush
Piyush

Reputation: 2609

You can open URL into your browser using:

String url="www.wikipedia.com"  
Intent browserIntent = new Intent("android.intent.action.VIEW", Uri.parse(url));
startActivity(browserIntent);

Upvotes: 1

Knossos
Knossos

Reputation: 16068

You need to create an Intent to open wikipedia.

Examples

Upvotes: 1

Related Questions