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.os.Bundle;

public class Main {
    public static void call(Context context, String s) {
        try {
            context.startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + s)));
        } catch (Exception e) {
            context.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("tel:" + s)));
        }
    }

    public static void startActivity(Context context, Class class1) {
        context.startActivity(new Intent(context, class1));
    }

    public static void startActivity(Context context, Class class1, Bundle bundle) {
        Intent intent = new Intent(context, class1);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }
}