List of usage examples for android.content Intent putExtra
@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value)
From source file:Main.java
private static void intentPick(String action, Activity activity, int requestCode, String title, String[] filter) {//from w ww.j av a2 s .c o m Intent intent = new Intent(action); if (title != null && title.length() > 0) intent.putExtra("org.openintents.extra.TITLE", title); if (filter != null && filter.length > 0) intent.putExtra("org.openintents.extra.FILTER", filter); activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static Intent sendEmail(String[] to, String subject, String body) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, to); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
From source file:Main.java
public static void updateIconBadge(Context context, int notiCnt) { Intent badgeIntent = new Intent("android.intent.action.BADGE_COUNT_UPDATE"); badgeIntent.putExtra("badge_count", notiCnt); badgeIntent.putExtra("badge_count_package_name", context.getPackageName()); badgeIntent.putExtra("badge_count_class_name", getLauncherClassName(context)); context.sendBroadcast(badgeIntent);//from ww w. j ava2s . c o m }
From source file:Main.java
public static Intent getAndroidShareIntent(CharSequence chooseTitle, CharSequence subject, CharSequence content) {/*ww w . j av a 2 s . c om*/ Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject); shareIntent.putExtra(Intent.EXTRA_TEXT, content); return Intent.createChooser(shareIntent, chooseTitle); }
From source file:Main.java
public static Intent getAndroidShareIntent(CharSequence chooseTitle, CharSequence subject, CharSequence content) {/*from w ww . j a v a2 s .c o m*/ Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, content); return Intent.createChooser(shareIntent, chooseTitle); }
From source file:Main.java
public static void addCallLog(Context context, ContentValues values, ContentValues extraValues) { ContentResolver contentResolver = context.getContentResolver(); Uri result = contentResolver.insert(CallLog.Calls.CONTENT_URI, values); if (result != null) { // Announce that to other apps final Intent broadcast = new Intent(ACTION_ANNOUNCE_SIP_CALLLOG); broadcast.putExtra(EXTRA_CALL_LOG_URI, result.toString()); String provider = extraValues.getAsString(EXTRA_SIP_PROVIDER); if (provider != null) { broadcast.putExtra(EXTRA_SIP_PROVIDER, provider); }/*from w ww . j a v a 2 s . com*/ context.sendBroadcast(broadcast); } }
From source file:Main.java
public static void sendIntent(Context context, Class classes, String key, String value, String anotherKey, String anotherValue) {//from w ww .j a v a2 s. co m Intent intent = new Intent(); intent.setClass(context, classes); intent.putExtra(key, value); intent.putExtra(anotherKey, anotherValue); context.startActivity(intent); }
From source file:Main.java
/** * Gets an {@link Intent} for starting Orbot. Orbot will reply with the * current status to the {@code packageName} of the app in the provided * {@link Context} (i.e. {@link Context#getPackageName()}. *///from ww w . ja v a2s .co m public static Intent getOrbotStartIntent(Context context) { Intent intent = new Intent(ACTION_START); intent.setPackage(ORBOT_PACKAGE_NAME); intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName()); return intent; }
From source file:Main.java
/** * Notifies UI to display a message./*ww w. j a v a2s .c o m*/ * <p> * This method is defined in the common helper because it's used both by * the UI and the background service. * * @param context application's context. * @param message message to be displayed. */ static void displayMessage(Context context, String message) { Intent intent = new Intent(DISPLAY_MESSAGE_ACTION); Log.d("GCM", message); intent.putExtra(EXTRA_MESSAGE, message); context.sendBroadcast(intent); }
From source file:Main.java
public static void openFeedback(Activity activity) { try {/*from ww w. j ava2 s . com*/ throw new Exception(); } catch (Exception e) { ApplicationErrorReport report = new ApplicationErrorReport(); report.packageName = report.processName = activity.getApplication().getPackageName(); report.time = System.currentTimeMillis(); report.type = ApplicationErrorReport.TYPE_CRASH; report.systemApp = false; ApplicationErrorReport.CrashInfo crash = new ApplicationErrorReport.CrashInfo(); crash.exceptionClassName = e.getClass().getSimpleName(); crash.exceptionMessage = e.getMessage(); StringWriter writer = new StringWriter(); PrintWriter printer = new PrintWriter(writer); e.printStackTrace(printer); crash.stackTrace = writer.toString(); StackTraceElement stack = e.getStackTrace()[0]; crash.throwClassName = stack.getClassName(); crash.throwFileName = stack.getFileName(); crash.throwLineNumber = stack.getLineNumber(); crash.throwMethodName = stack.getMethodName(); report.crashInfo = crash; Intent intent = new Intent(Intent.ACTION_APP_ERROR); intent.putExtra(Intent.EXTRA_BUG_REPORT, report); activity.startActivity(intent); } }