Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;
import android.content.Intent;

import android.net.Uri;

import android.util.Log;

public class Main {
    public static void openUrl(Context context, String url) {
        if (!url.startsWith("https://") && !url.startsWith("http://")) {
            url = "http://" + url;
        }

        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(url));
        //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        Log.d("WipiwayController", "openUrl . Openning link - " + url);

        context.startActivity(i);
    }
}