Example usage for android.content Intent Intent

List of usage examples for android.content Intent Intent

Introduction

In this page you can find the example usage for android.content Intent Intent.

Prototype

protected Intent(Parcel in) 

Source Link

Usage

From source file:Main.java

public static void searchWeb(Context context, String word) {
    Intent i = new Intent(Intent.ACTION_WEB_SEARCH);
    i.putExtra(SearchManager.QUERY, word);
    context.startActivity(i);/*from   w  w w. j  a  v a  2s  .c o m*/
}

From source file:Main.java

public static void openSetting(Context context) {
    Intent intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
    context.startActivity(intent);//from   w ww. j av a 2 s . c o  m
}

From source file:Main.java

public static void selectImage(Activity activity, int i) {
    Intent intent = new Intent("android.intent.action.GET_CONTENT");
    intent.setType("image/*");
    activity.startActivityForResult(Intent.createChooser(intent, activity.getString(0x7f080083)), i);
}

From source file:Main.java

private static Intent linkingToMarket(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));//from www . j  a v a 2  s . c om
    return intent;
}

From source file:Main.java

public static void startPhone(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    // intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);/*from ww  w  . j  a  v  a 2 s . c om*/
}

From source file:Main.java

public static void sendEmail(Context context, String receiver) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:" + receiver));
    context.startActivity(intent);//from   w w w . j  a  v a 2s. co m
}

From source file:Main.java

public static void startSetActivity(Activity activity) {
    Intent intent = new Intent(Settings.ACTION_SETTINGS);
    activity.startActivity(intent);
}

From source file:Main.java

public static void openSetting(Activity activity) {
    Intent intent = new Intent("/");
    ComponentName cm = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
    intent.setComponent(cm);/*from  w  ww  . j  a v a 2s .com*/
    intent.setAction("android.intent.action.VIEW");
    activity.startActivityForResult(intent, 0);
}

From source file:Main.java

public static Intent getWordFileIntent(String param) {

    Intent intent = new Intent("android.intent.action.VIEW");

    intent.addCategory("android.intent.category.DEFAULT");

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    Uri uri = Uri.fromFile(new File(param));

    intent.setDataAndType(uri, "application/msword");

    return intent;

}

From source file:Main.java

public static void goHome(Context context) {
    Intent mHomeIntent = new Intent(Intent.ACTION_MAIN);
    mHomeIntent.addCategory(Intent.CATEGORY_HOME);
    mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    context.startActivity(mHomeIntent);/*from   w ww.  j av a  2 s . c o  m*/
}