Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import android.util.Log;
import android.widget.Toast;

public class Main {
    private static final String TAG = "UiUtil";

    public static void startWebIntent(Context context, String url) {
        try {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            context.startActivity(intent);
        } catch (Exception ex) {
            Log.e(TAG, "Error starting url intent.", ex);
            Toast.makeText(context, "Sorry, we couldn't find any app for viewing this url!", Toast.LENGTH_SHORT)
                    .show();
        }
    }
}