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 Intent getHelpIntent() {
    return new Intent("com.announcify.HELP");
}

From source file:Main.java

public static Intent getPhoneIntent() {
    Intent phoneIntent = new Intent(Intent.ACTION_DIAL);
    phoneIntent.setData(Uri.parse("tel:+1234567890"));
    return phoneIntent;
}

From source file:Main.java

public static Intent getInstallIntent(Uri uri) {
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setDataAndType(uri, "application/vnd.android.package-archive");
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return i;//from   ww w  .  ja  v  a  2s  .c  o m
}

From source file:Main.java

public static Intent createShareIntent(String title, String text) {
    final Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("content/plain");
    intent.putExtra(Intent.EXTRA_TEXT, text);
    return Intent.createChooser(intent, title);
}

From source file:Main.java

public static Intent getInstallIntent(Uri uri) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(uri, "application/vnd.android.package-archive");
    return intent;
}

From source file:Main.java

public static Intent getMediaIntent(String path) {
    Intent it = new Intent(Intent.ACTION_VIEW);
    Uri uri = Uri.parse(path);/*from   w w w  .ja v a2s  .  co  m*/
    it.setDataAndType(uri, "audio/mp3");
    return it;
}

From source file:Main.java

public static Intent newTelIntent(String telurl) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    // FIXME : need to check XXX is really a short number in tel:XXX 
    intent.setData(Uri.parse(telurl));//  www  .  j a  va2 s  . c o  m
    return intent;
}

From source file:Main.java

public static void showDesk(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);/*from  w w  w .  j  a  v a2  s  .  c  o  m*/
}

From source file:Main.java

public static void openDail(Context getContext) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext.startActivity(intent);//  w w w.  java  2s  . c o m
}

From source file:Main.java

public static void newMessage(Context context) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setType("vnd.android-dir/mms-sms");
    // intent.putExtra("sms_body", "");
    context.startActivity(intent);/*www . jav  a  2  s . c o  m*/
}