Example usage for android.content Intent ACTION_MAIN

List of usage examples for android.content Intent ACTION_MAIN

Introduction

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

Prototype

String ACTION_MAIN

To view the source code for android.content Intent ACTION_MAIN.

Click Source Link

Document

Activity Action: Start as a main entry point, does not expect to receive data.

Usage

From source file:com.fbbackup.MyFriendFragmentActivity.java

/**
 * }app//from w w w  . j av  a2s.  c o m
 */
public void exit() {

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);

}

From source file:it.feio.android.omninotes.DetailFragment.java

private void handleIntents() {
    Intent i = mainActivity.getIntent();

    if (IntentChecker.checkAction(i, Constants.ACTION_MERGE)) {
        noteOriginal = new Note();
        note = new Note(noteOriginal);
        noteTmp = getArguments().getParcelable(Constants.INTENT_NOTE);
        if (i.getStringArrayListExtra("merged_notes") != null) {
            mergedNotesIds = i.getStringArrayListExtra("merged_notes");
        }//from w w  w.  j a v  a  2 s.  c om
    }

    // Action called from home shortcut
    if (IntentChecker.checkAction(i, Constants.ACTION_SHORTCUT, Constants.ACTION_NOTIFICATION_CLICK)) {
        afterSavedReturnsToList = false;
        noteOriginal = DbHelper.getInstance().getNote(i.getLongExtra(Constants.INTENT_KEY, 0));
        // Checks if the note pointed from the shortcut has been deleted
        try {
            note = new Note(noteOriginal);
            noteTmp = new Note(noteOriginal);
        } catch (NullPointerException e) {
            mainActivity.showToast(getText(R.string.shortcut_note_deleted), Toast.LENGTH_LONG);
            mainActivity.finish();
        }
    }

    // Check if is launched from a widget
    if (IntentChecker.checkAction(i, Constants.ACTION_WIDGET, Constants.ACTION_TAKE_PHOTO)) {

        afterSavedReturnsToList = false;
        showKeyboard = true;

        //  with tags to set tag
        if (i.hasExtra(Constants.INTENT_WIDGET)) {
            String widgetId = i.getExtras().get(Constants.INTENT_WIDGET).toString();
            if (widgetId != null) {
                String sqlCondition = prefs.getString(Constants.PREF_WIDGET_PREFIX + widgetId, "");
                String categoryId = TextHelper.checkIntentCategory(sqlCondition);
                if (categoryId != null) {
                    Category category;
                    try {
                        category = DbHelper.getInstance().getCategory(Long.parseLong(categoryId));
                        noteTmp = new Note();
                        noteTmp.setCategory(category);
                    } catch (NumberFormatException e) {
                        Log.e(Constants.TAG, "Category with not-numeric value!", e);
                    }
                }
            }
        }

        // Sub-action is to take a photo
        if (IntentChecker.checkAction(i, Constants.ACTION_TAKE_PHOTO)) {
            takePhoto();
        }
    }

    /**
     * Handles third party apps requests of sharing
     */
    if (IntentChecker.checkAction(i, Intent.ACTION_SEND, Intent.ACTION_SEND_MULTIPLE,
            Constants.INTENT_GOOGLE_NOW) && i.getType() != null) {

        afterSavedReturnsToList = false;

        if (noteTmp == null)
            noteTmp = new Note();

        // Text title
        String title = i.getStringExtra(Intent.EXTRA_SUBJECT);
        if (title != null) {
            noteTmp.setTitle(title);
        }

        // Text content
        String content = i.getStringExtra(Intent.EXTRA_TEXT);
        if (content != null) {
            noteTmp.setContent(content);
        }

        // Single attachment data
        Uri uri = i.getParcelableExtra(Intent.EXTRA_STREAM);
        // Due to the fact that Google Now passes intent as text but with
        // audio recording attached the case must be handled in specific way
        if (uri != null && !Constants.INTENT_GOOGLE_NOW.equals(i.getAction())) {
            String name = FileHelper.getNameFromUri(mainActivity, uri);
            AttachmentTask task = new AttachmentTask(this, uri, name, this);
            task.execute();
        }

        // Multiple attachment data
        ArrayList<Uri> uris = i.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
        if (uris != null) {
            for (Uri uriSingle : uris) {
                String name = FileHelper.getNameFromUri(mainActivity, uriSingle);
                AttachmentTask task = new AttachmentTask(this, uriSingle, name, this);
                task.execute();
            }
        }

        //         i.setAction(null);
    }

    if (IntentChecker.checkAction(i, Intent.ACTION_MAIN, Constants.ACTION_WIDGET_SHOW_LIST)) {
        showKeyboard = true;
    }

}

From source file:com.etime.ETimeActivity.java

/**
 * Callback for pressing the back button. Used to prevent the app
 * from destroying it self if the back button is pressed to go to
 * previous app/homescreen./*www.  j a  v  a  2  s  .co m*/
 */
@Override
public void onBackPressed() {
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity);
    if (pref.getBoolean(getString(R.string.keepInBackground), true)) {
        Intent setIntent = new Intent(Intent.ACTION_MAIN);
        setIntent.addCategory(Intent.CATEGORY_HOME);
        setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(setIntent);
    } else {
        super.onBackPressed();
    }
}

From source file:mp.teardrop.PlaybackService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null) {
        String action = intent.getAction();

        if (ACTION_TOGGLE_PLAYBACK.equals(action)) {
            playPause();/*from ww  w  .  j  a  va2s.c  om*/
        } else if (ACTION_TOGGLE_PLAYBACK_NOTIFICATION.equals(action)) {
            mForceNotificationVisible = true;
            synchronized (mStateLock) {
                if ((mState & FLAG_PLAYING) != 0)
                    pause();
                else
                    play();
            }
        } else if (ACTION_TOGGLE_PLAYBACK_DELAYED.equals(action)) {
            if (mHandler.hasMessages(CALL_GO, Integer.valueOf(0))) {
                mHandler.removeMessages(CALL_GO, Integer.valueOf(0));
                Intent launch = new Intent(this, LibraryActivity.class);
                launch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                launch.setAction(Intent.ACTION_MAIN);
                startActivity(launch);
            } else {
                mHandler.sendMessageDelayed(mHandler.obtainMessage(CALL_GO, 0, 0, Integer.valueOf(0)), 400);
            }
        } else if (ACTION_NEXT_SONG.equals(action)) {
            setCurrentSong(1, false);
            userActionTriggered();
        } else if (ACTION_NEXT_SONG_AUTOPLAY.equals(action)) {
            setCurrentSong(1, false);
            play();
        } else if (ACTION_NEXT_SONG_DELAYED.equals(action)) {
            if (mHandler.hasMessages(CALL_GO, Integer.valueOf(1))) {
                mHandler.removeMessages(CALL_GO, Integer.valueOf(1));
                Intent launch = new Intent(this, LibraryActivity.class);
                launch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                launch.setAction(Intent.ACTION_MAIN);
                startActivity(launch);
            } else {
                mHandler.sendMessageDelayed(mHandler.obtainMessage(CALL_GO, 1, 0, Integer.valueOf(1)), 400);
            }
        } else if (ACTION_PREVIOUS_SONG.equals(action)) {
            setCurrentSong(-1, false);
            userActionTriggered();
        } else if (ACTION_REWIND_SONG.equals(action)) {
            /* only rewind song IF we played more than 2.5 sec (and song is longer than 5 sec) */
            if (getPosition() > REWIND_AFTER_PLAYED_MS && getDuration() > REWIND_AFTER_PLAYED_MS * 2) {
                setCurrentSong(0, false);
            } else {
                setCurrentSong(-1, false);
            }
            play();
        } else if (ACTION_PLAY.equals(action)) {
            play();
        } else if (ACTION_PAUSE.equals(action)) {
            pause();
        } else if (ACTION_CYCLE_REPEAT.equals(action)) {
            cycleFinishAction();
        } else if (ACTION_CYCLE_SHUFFLE.equals(action)) {
            cycleShuffle();
        } else if (ACTION_CLOSE_NOTIFICATION.equals(action)) {
            mForceNotificationVisible = false;
            pause();
            stopForeground(true); // sometimes required to clear notification
            mNotificationManager.cancel(NOTIFICATION_ID);
        }

        MediaButtonReceiver.registerMediaButton(this);
    }

    return START_NOT_STICKY;
}

From source file:nu.yona.app.utils.AppUtils.java

private static Intent getVPNIntent(VpnProfile profile, Context context) {
    ProfileManager.getInstance(context).saveProfile(context, profile);
    Intent intent = new Intent(context, LaunchVPN.class);
    intent.putExtra(LaunchVPN.EXTRA_KEY, profile.getUUID().toString());
    intent.setAction(Intent.ACTION_MAIN);
    intent.putExtra(AppConstant.FROM_LOGIN, true);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    boolean showOpenVpnLog = YonaApplication.getEventChangeManager().getSharedPreference().getAppPreferences()
            .getBoolean(AppConstant.SHOW_VPN_WINDOW, false);
    intent.putExtra(LaunchVPN.EXTRA_HIDELOG, !showOpenVpnLog);
    return intent;
}

From source file:com.air.mobilebrowser.BrowserActivity.java

/**
 * Determine if the application is set as the default
 * home.//from   ww  w.j  ava2 s .c  o m
 * @return true if the default home package is the secure browser, false
 * otherwise.
 */
public boolean validateHomePackage() {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);

    PackageManager pm = getPackageManager();
    final ResolveInfo mInfo = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
    String homePackage = mInfo.activityInfo.packageName;
    return homePackage.equals(getPackageName());
}

From source file:org.videolan.vlc.AudioService.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void showNotification() {
    try {/*ww w.j ava  2 s . c  om*/
        Bitmap cover = AudioUtil.getCover(this, mCurrentMedia, 64);
        String title = mCurrentMedia.getTitle();
        String artist = mCurrentMedia.getArtist();
        String album = mCurrentMedia.getAlbum();
        Notification notification;

        // add notification to status bar
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_stat_vlc).setTicker(title + " - " + artist).setAutoCancel(false)
                .setOngoing(true);

        Intent notificationIntent = new Intent(this, AudioPlayerActivity.class);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        notificationIntent.putExtra(START_FROM_NOTIFICATION, true);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        if (Util.isJellyBeanOrLater()) {
            Intent iBackward = new Intent(ACTION_REMOTE_BACKWARD);
            Intent iPlay = new Intent(ACTION_REMOTE_PLAYPAUSE);
            Intent iForward = new Intent(ACTION_REMOTE_FORWARD);
            Intent iStop = new Intent(ACTION_REMOTE_STOP);
            PendingIntent piBackward = PendingIntent.getBroadcast(this, 0, iBackward,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piPlay = PendingIntent.getBroadcast(this, 0, iPlay,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piForward = PendingIntent.getBroadcast(this, 0, iForward,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            PendingIntent piStop = PendingIntent.getBroadcast(this, 0, iStop,
                    PendingIntent.FLAG_UPDATE_CURRENT);

            RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification);
            if (cover != null)
                view.setImageViewBitmap(R.id.cover, cover);
            view.setTextViewText(R.id.songName, title);
            view.setTextViewText(R.id.artist, artist);
            view.setImageViewResource(R.id.play_pause,
                    mLibVLC.isPlaying() ? R.drawable.ic_pause : R.drawable.ic_play);
            view.setOnClickPendingIntent(R.id.play_pause, piPlay);
            view.setOnClickPendingIntent(R.id.forward, piForward);
            view.setOnClickPendingIntent(R.id.stop, piStop);
            view.setOnClickPendingIntent(R.id.content, pendingIntent);

            RemoteViews view_expanded = new RemoteViews(getPackageName(), R.layout.notification_expanded);
            if (cover != null)
                view_expanded.setImageViewBitmap(R.id.cover, cover);
            view_expanded.setTextViewText(R.id.songName, title);
            view_expanded.setTextViewText(R.id.artist, artist);
            view_expanded.setTextViewText(R.id.album, album);
            view_expanded.setImageViewResource(R.id.play_pause,
                    mLibVLC.isPlaying() ? R.drawable.ic_pause : R.drawable.ic_play);
            view_expanded.setOnClickPendingIntent(R.id.backward, piBackward);
            view_expanded.setOnClickPendingIntent(R.id.play_pause, piPlay);
            view_expanded.setOnClickPendingIntent(R.id.forward, piForward);
            view_expanded.setOnClickPendingIntent(R.id.stop, piStop);
            view_expanded.setOnClickPendingIntent(R.id.content, pendingIntent);

            notification = builder.build();
            notification.contentView = view;
            notification.bigContentView = view_expanded;
        } else {
            builder.setLargeIcon(cover).setContentTitle(title)
                    .setContentText(Util.isJellyBeanOrLater() ? artist : mCurrentMedia.getSubtitle())
                    .setContentInfo(album).setContentIntent(pendingIntent);
            notification = builder.build();
        }

        startForeground(3, notification);
    } catch (NoSuchMethodError e) {
        // Compat library is wrong on 3.2
        // http://code.google.com/p/android/issues/detail?id=36359
        // http://code.google.com/p/android/issues/detail?id=36502
    }
}

From source file:com.android.messaging.ui.UIIntentsImpl.java

@Override
public Intent getWirelessAlertsIntent() {
    final Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setComponent(new ComponentName(CMAS_COMPONENT, CELL_BROADCAST_LIST_ACTIVITY));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:com.sentaroh.android.TaskAutomation.TaskExecutor.java

final static private void executeAndroidActivity(TaskManagerParms taskMgrParms, EnvironmentParms envParms,
        CommonUtilities util, TaskResponse task_response, ActionResponse ar, String task, String pkg,
        TaskActionItem eali) {//from w ww  . j  a v  a  2  s  .co  m
    util.addLogMsg("I", String.format(taskMgrParms.teMsgs.msgs_thread_task_exec_android, task, pkg));
    final PackageManager pm = taskMgrParms.context.getPackageManager();
    Intent in = pm.getLaunchIntentForPackage(pkg);
    ar.action_resp = ActionResponse.ACTION_SUCCESS;
    if (in != null) {
        in.setAction(Intent.ACTION_MAIN);
        in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
        if (eali.action_activity_data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_DATA_TYPE_URI)) {
            in.setData(Uri.parse(eali.action_activity_data_uri));
            if (envParms.settingDebugLevel >= 1)
                util.addDebugMsg(1, "I", "   Uri data added : Uri=", eali.action_activity_data_uri);
        } else if (eali.action_activity_data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_DATA_TYPE_EXTRA)) {
            ArrayList<ActivityExtraDataItem> aed_list = eali.action_activity_data_extra_list;
            for (int i = 0; i < aed_list.size(); i++) {
                ActivityExtraDataItem aedi = aed_list.get(i);
                if (aedi.data_value_array.equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_ARRAY_NO)) {
                    String d_val_string = "";
                    boolean d_val_boolean = false;
                    int d_val_int = 0;
                    if (aedi.data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_STRING)) {
                        d_val_string = aedi.data_value;
                        in.putExtra(aedi.key_value, d_val_string);
                        if (envParms.settingDebugLevel >= 1)
                            util.addDebugMsg(1, "I", "   Extra String data added : key=", aedi.key_value,
                                    ", value=", d_val_string);
                    } else if (aedi.data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_INT)) {
                        d_val_int = Integer.valueOf(aedi.data_value);
                        in.putExtra(aedi.key_value, d_val_int);
                        if (envParms.settingDebugLevel >= 1)
                            util.addDebugMsg(1, "I", "   Extra Int data added : key=", aedi.key_value,
                                    ", value=", String.valueOf(d_val_int));
                    } else if (aedi.data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_BOOLEAN)) {
                        if (aedi.data_value.equals("true"))
                            d_val_boolean = true;
                        in.putExtra(aedi.key_value, d_val_boolean);
                        if (envParms.settingDebugLevel >= 1)
                            util.addDebugMsg(1, "I", "   Extra Boolean data added : key=", aedi.key_value,
                                    ", value=", String.valueOf(d_val_boolean));
                    }
                } else if (aedi.data_value_array
                        .equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_ARRAY_YES)) {
                    if (aedi.data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_STRING)) {
                        String[] d_val_array = aedi.data_value.split("\u0003");
                        String[] d_val_extra = new String[d_val_array.length];
                        for (int ai = 0; ai < d_val_array.length; ai++) {
                            d_val_extra[ai] = d_val_array[ai];
                            if (envParms.settingDebugLevel >= 1)
                                util.addDebugMsg(1, "I", "   Extra array String data added : key=",
                                        aedi.key_value, ", value=", d_val_extra[ai]);
                        }
                        in.putExtra(aedi.key_value, d_val_extra);
                    } else if (aedi.data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_INT)) {
                        String[] d_val_array = aedi.data_value.split("\u0003");
                        int[] d_val_extra = new int[d_val_array.length];
                        for (int ai = 0; ai < d_val_array.length; ai++) {
                            d_val_extra[ai] = Integer.valueOf(d_val_array[ai]);
                            if (envParms.settingDebugLevel >= 1)
                                util.addDebugMsg(1, "I", "   Extra array Int data added : key=", aedi.key_value,
                                        ", value=", String.valueOf(d_val_extra[ai]));
                        }
                        in.putExtra(aedi.key_value, d_val_extra);
                    } else if (aedi.data_type.equals(PROFILE_ACTION_TYPE_ACTIVITY_EXTRA_DATA_VALUE_BOOLEAN)) {
                        String[] d_val_array = aedi.data_value.split("\u0003");
                        boolean[] d_val_extra = new boolean[d_val_array.length];
                        for (int ai = 0; ai < d_val_array.length; ai++) {
                            if (d_val_array[ai].equals("true"))
                                d_val_extra[ai] = true;
                            else
                                d_val_extra[ai] = false;
                            if (envParms.settingDebugLevel >= 1)
                                util.addDebugMsg(1, "I", "   Extra array Boolean data added : key=",
                                        aedi.key_value, ", value=", String.valueOf(d_val_extra[ai]));
                        }
                        in.putExtra(aedi.key_value, d_val_extra);
                    }
                }
            }
        } else {
            if (envParms.settingDebugLevel >= 1)
                util.addDebugMsg(1, "I", "   No data was supplied");
        }
        taskMgrParms.context.startActivity(in);
        task_response.active_thread_ctrl.setThreadResultSuccess();
        waitTimeTc(task_response, 100);
    } else {
        String msg = String.format(taskMgrParms.teMsgs.msgs_thread_task_intent_notfound, pkg);
        util.addLogMsg("E", msg);
        ar.action_resp = ActionResponse.ACTION_ERROR;
        ar.resp_msg_text = msg;
    }
}

From source file:com.dycody.android.idealnote.DetailFragment.java

private void handleIntents() {
    Intent i = mainActivity.getIntent();

    if (IntentChecker.checkAction(i, Constants.ACTION_MERGE)) {
        noteOriginal = new Note();
        note = new Note(noteOriginal);
        noteTmp = getArguments().getParcelable(Constants.INTENT_NOTE);
        if (i.getStringArrayListExtra("merged_notes") != null) {
            mergedNotesIds = i.getStringArrayListExtra("merged_notes");
        }//from www .j av a2  s.  c  om
    }

    // Action called from home shortcut
    if (IntentChecker.checkAction(i, Constants.ACTION_SHORTCUT, Constants.ACTION_NOTIFICATION_CLICK)) {
        afterSavedReturnsToList = false;
        noteOriginal = DbHelper.getInstance().getNote(i.getLongExtra(Constants.INTENT_KEY, 0));
        // Checks if the note pointed from the shortcut has been deleted
        try {
            note = new Note(noteOriginal);
            noteTmp = new Note(noteOriginal);
        } catch (NullPointerException e) {
            mainActivity.showToast(getText(R.string.shortcut_note_deleted), Toast.LENGTH_LONG);
            mainActivity.finish();
        }
    }

    // Check if is launched from a widget
    if (IntentChecker.checkAction(i, Constants.ACTION_WIDGET, Constants.ACTION_TAKE_PHOTO)) {

        afterSavedReturnsToList = false;
        showKeyboard = true;

        //  with tags to set tag
        if (i.hasExtra(Constants.INTENT_WIDGET)) {
            String widgetId = i.getExtras().get(Constants.INTENT_WIDGET).toString();
            if (widgetId != null) {
                String sqlCondition = prefs.getString(Constants.PREF_WIDGET_PREFIX + widgetId, "");
                String categoryId = TextHelper.checkIntentCategory(sqlCondition);
                if (categoryId != null) {
                    Category category;
                    try {
                        category = DbHelper.getInstance().getCategory(Long.parseLong(categoryId));
                        noteTmp = new Note();
                        noteTmp.setCategory(category);
                    } catch (NumberFormatException e) {
                        Log.e(Constants.TAG, "Category with not-numeric value!", e);
                    }
                }
            }
        }

        // Sub-action is to take a photo
        if (IntentChecker.checkAction(i, Constants.ACTION_TAKE_PHOTO)) {
            takePhoto();
        }
    }

    /**
     * Handles third party apps requests of sharing
     */
    if (IntentChecker.checkAction(i, Intent.ACTION_SEND, Intent.ACTION_SEND_MULTIPLE,
            Constants.INTENT_GOOGLE_NOW) && i.getType() != null) {

        afterSavedReturnsToList = false;

        if (noteTmp == null)
            noteTmp = new Note();

        // Text title
        String title = i.getStringExtra(Intent.EXTRA_SUBJECT);
        if (title != null) {
            noteTmp.setTitle(title);
        }

        // Text content
        String content = i.getStringExtra(Intent.EXTRA_TEXT);
        if (content != null) {
            noteTmp.setContent(content);
        }

        // Single attachment data
        Uri uri = i.getParcelableExtra(Intent.EXTRA_STREAM);
        // Due to the fact that Google Now passes intent as text but with
        // audio recording attached the case must be handled in specific way
        if (uri != null && !Constants.INTENT_GOOGLE_NOW.equals(i.getAction())) {
            String name = FileHelper.getNameFromUri(mainActivity, uri);
            new AttachmentTask(this, uri, name, this).execute();
        }

        // Multiple attachment data
        ArrayList<Uri> uris = i.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
        if (uris != null) {
            for (Uri uriSingle : uris) {
                String name = FileHelper.getNameFromUri(mainActivity, uriSingle);
                new AttachmentTask(this, uriSingle, name, this).execute();
            }
        }
    }

    if (IntentChecker.checkAction(i, Intent.ACTION_MAIN, Constants.ACTION_WIDGET_SHOW_LIST,
            Constants.ACTION_SHORTCUT_WIDGET, Constants.ACTION_WIDGET)) {
        showKeyboard = true;
    }

    i.setAction(null);
}