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.os.Bundle;
import java.io.Serializable;

public class Main {
    public static void sendBroadcast(Context context, String filter) {
        if (context == null) {
            return;
        }
        Intent intent = new Intent();
        intent.setAction(filter);
        context.sendBroadcast(intent);
    }

    public static void sendBroadcast(Context context, String filter, Bundle bundle) {
        if (context == null) {
            return;
        }
        Intent intent = new Intent();
        intent.setAction(filter);
        intent.putExtras(bundle);
        context.sendBroadcast(intent);
    }

    public static void sendBroadcast(Context context, String filter, String bundleName, Bundle bundle) {
        if (context == null) {
            return;
        }
        Intent intent = new Intent();
        intent.setAction(filter);
        intent.putExtra(bundleName, bundle);
        context.sendBroadcast(intent);
    }

    public static void sendBroadcast(Context context, String filter, String name, Serializable serializable) {
        Intent intent = new Intent();
        intent.putExtra(name, serializable);
        intent.setAction(filter);
        context.sendBroadcast(intent);
    }

    public static void sendBroadcast(Context context, String filter, String name, String value) {
        Intent intent = new Intent();
        intent.putExtra(name, value);
        intent.setAction(filter);
        context.sendBroadcast(intent);
    }

    public static void sendBroadcast(Context context, String filter, String name, long value) {
        Intent intent = new Intent();
        intent.putExtra(name, value);
        intent.setAction(filter);
        context.sendBroadcast(intent);
    }

    public static void sendBroadcast(Context context, String filter, String name, int value) {
        Intent intent = new Intent();
        intent.putExtra(name, value);
        intent.setAction(filter);
        context.sendBroadcast(intent);
    }

    public static void sendBroadcast(Context context, String filter, String name, String value, String name1,
            String value1) {
        Intent intent = new Intent();
        intent.putExtra(name, value);
        intent.putExtra(name1, value1);
        intent.setAction(filter);
        context.sendBroadcast(intent);
    }
}