Example usage for android.content Intent toString

List of usage examples for android.content Intent toString

Introduction

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

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.brandroid.openmanager.fragments.ContentFragment.java

public boolean executeMenu(final int id, final Object mode, final OpenPath file) {
    Logger.LogInfo("ContentFragment.executeMenu(0x" + Integer.toHexString(id) + ") on " + file);
    final String path = file != null ? file.getPath() : null;
    OpenPath parent = file != null ? file.getParent() : mPath;
    if (parent == null || parent instanceof OpenCursor)
        parent = OpenFile.getExternalMemoryDrive(true);
    final OpenPath folder = parent;
    String name = file != null ? file.getName() : null;

    final boolean fromPasteMenu = file.equals(mPath);

    switch (id) {
    case R.id.menu_refresh:
        if (DEBUG)
            Logger.LogDebug("Refreshing " + getPath().getPath());
        getPath().clearChildren();/*  w w w.j  av a  2  s. com*/
        FileManager.removeOpenCache(getPath().getPath());
        getPath().deleteFolderFromDb();
        runUpdateTask(true);
        refreshData(new Bundle(), false);
        return true;

    case R.id.menu_context_download:
        OpenPath dl = OpenExplorer.getDownloadParent().getFirstDir();
        if (dl == null)
            dl = OpenFile.getExternalMemoryDrive(true);
        if (dl != null) {
            List<OpenPath> files = new ArrayList<OpenPath>();
            files.add(file);
            getEventHandler().copyFile(files, dl, getActivity());
        } else
            getExplorer().showToast(R.string.s_error_ftp);
        return true;

    case R.id.menu_context_selectall:
        if (getContentAdapter() == null)
            return false;
        boolean hasAll = true;
        for (OpenPath p : getContentAdapter().getAll())
            if (!getClipboard().contains(p)) {
                hasAll = false;
                break;
            }
        if (!hasAll)
            getClipboard().addAll(getContentAdapter().getAll());
        else
            getClipboard().removeAll(getContentAdapter().getAll());
        return true;

    case R.id.menu_context_view:
        Intent vintent = IntentManager.getIntent(file, getExplorer(), Intent.ACTION_VIEW);
        if (vintent != null)
            getActivity().startActivity(vintent);
        else {
            if (getExplorer() != null)
                getExplorer().showToast(R.string.s_error_no_intents);
            if (file.length() < getResources().getInteger(R.integer.max_text_editor_size))
                getExplorer().editFile(file);
        }
        break;

    case R.id.menu_context_edit:
        Intent intent = IntentManager.getIntent(file, getExplorer(), Intent.ACTION_EDIT);
        if (intent != null) {
            if (intent.getPackage() != null && intent.getPackage().equals(getActivity().getPackageName()))
                getExplorer().editFile(file);
            else
                try {
                    intent.setAction(Intent.ACTION_EDIT);
                    Logger.LogVerbose("Starting Intent: " + intent.toString());
                    getExplorer().startActivity(intent);
                } catch (ActivityNotFoundException e) {
                    getExplorer().showToast(R.string.s_error_no_intents);
                    getExplorer().editFile(file);
                }
        } else if (file.length() < getResources().getInteger(R.integer.max_text_editor_size)) {
            getExplorer().editFile(file);
        } else {
            getExplorer().showToast(R.string.s_error_no_intents);
        }
        break;

    case R.id.menu_multi:
        changeMultiSelectState(!getClipboard().isMultiselect());
        if (!fromPasteMenu)
            getClipboard().add(file);
        return true;
    case R.id.menu_context_bookmark:
        getExplorer().addBookmark(file);
        finishMode(mode);
        return true;

    case R.id.menu_context_delete:
        //fileList.add(file);
        getHandler().deleteFile(file, getActivity(), true);
        finishMode(mode);
        if (getContentAdapter() != null)
            getContentAdapter().notifyDataSetChanged();
        return true;

    case R.id.menu_context_rename:
        getHandler().renameFile(file, true, getActivity());
        finishMode(mode);
        return true;

    case R.id.menu_context_copy:
    case R.id.menu_context_cut:
        getClipboard().DeleteSource = id == R.id.menu_context_cut;
        file.setTag(id);
        getClipboard().add(file);
        return true;

    case R.id.menu_context_paste:
    case R.id.content_paste:
        OpenPath into = file;
        if (fromPasteMenu)
            into = mPath;
        if (!file.isDirectory()) {
            Logger.LogWarning("Can't paste into file (" + file.getPath() + "). Using parent directory ("
                    + folder.getPath() + ")");
            into = folder;
        }
        OpenClipboard cb = getClipboard();
        cb.setCurrentPath(into);
        if (cb.size() > 0) {
            if (cb.DeleteSource)
                getHandler().cutFile(cb, into, getActivity());
            else
                getHandler().copyFile(cb, into, getActivity());
            refreshOperations();
        }

        cb.DeleteSource = false;
        if (cb.ClearAfter)
            getClipboard().clear();
        getExplorer().updateTitle(path);
        finishMode(mode);
        return true;

    case R.id.menu_context_zip:
        if (!fromPasteMenu)
            getClipboard().add(file);
        else
            getClipboard().setCurrentPath(mPath);

        getClipboard().ClearAfter = true;
        String zname = getClipboard().get(0).getName().replace("." + file.getExtension(), "") + ".zip";
        if (getClipboard().size() > 1) {
            OpenPath last = getClipboard().get(getClipboard().getCount() - 1);
            if (last != null && last.getParent() != null) {
                if (last.getParent() instanceof OpenCursor)
                    zname = folder.getPath();
                zname = last.getParent().getName() + ".zip";
            }
        }
        final String def = zname;

        final InputDialog dZip = new InputDialog(getExplorer()).setIcon(R.drawable.sm_zip)
                .setTitle(R.string.s_menu_zip).setMessageTop(R.string.s_prompt_path)
                .setDefaultTop(mPath.getPath()).setMessage(R.string.s_prompt_zip).setCancelable(true)
                .setNegativeButton(android.R.string.no, new OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        if (!fromPasteMenu && getClipboard().size() <= 1)
                            getClipboard().clear();
                    }
                });
        dZip.setOnCancelListener(new OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                if (fromPasteMenu && getClipboard().size() <= 1)
                    getClipboard().clear();
            }
        }).setPositiveButton(android.R.string.ok, new OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                OpenPath zFolder = new OpenFile(dZip.getInputTopText());
                if (zFolder == null || !zFolder.exists())
                    zFolder = folder;
                OpenPath zipFile = zFolder.getChild(dZip.getInputText());
                Logger.LogVerbose("Zipping " + getClipboard().size() + " items to " + zipFile.getPath());
                getHandler().zipFile(zipFile, getClipboard(), getExplorer());
                refreshOperations();
                finishMode(mode);
            }
        }).setDefaultText(def);
        dZip.create().show();
        return true;

    //case R.id.menu_context_unzip:
    //   getHandler().unzipFile(file, getExplorer());
    //   return true;

    case R.id.menu_context_info:
        DialogHandler.showFileInfo(getExplorer(), file);
        finishMode(mode);
        return true;

    case R.id.menu_multi_all_clear:
        getClipboard().clear();
        return true;

    case R.id.menu_context_share:

        // TODO: WTF is this?
        Intent mail = new Intent();
        mail.setType("application/mail");

        mail.setAction(android.content.Intent.ACTION_SEND);
        mail.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));
        startActivity(mail);

        //mode.finish();
        return true;

    //         this is for bluetooth
    //         files.add(path);
    //         getHandler().sendFile(files);
    //         mode.finish();
    //         return true;
    }
    return false;
}

From source file:com.xandy.calendar.AllInOneActivity.java

@Override
protected void onCreate(Bundle icicle) {
    if (Utils.getSharedPreference(this, OtherPreferences.KEY_OTHER_1, false)) {
        setTheme(R.style.CalendarTheme_WithActionBarWallpaper);
    }//ww  w . j a  v  a 2  s  .c o  m
    super.onCreate(icicle);

    if (icicle != null && icicle.containsKey(BUNDLE_KEY_CHECK_ACCOUNTS)) {
        mCheckForAccounts = icicle.getBoolean(BUNDLE_KEY_CHECK_ACCOUNTS);
    }
    // Launch add google account if this is first time and there are no
    // accounts yet
    if (mCheckForAccounts && !Utils.getSharedPreference(this, GeneralPreferences.KEY_SKIP_SETUP, false)) {

        mHandler = new QueryHandler(this.getContentResolver());
        mHandler.startQuery(0, null, Calendars.CONTENT_URI, new String[] { Calendars._ID }, null,
                null /* selection args */, null /* sort order */);
    }

    // This needs to be created before setContentView
    mController = CalendarController.getInstance(this);

    // Get time from intent or icicle
    long timeMillis = -1;
    int viewType = -1;
    final Intent intent = getIntent();
    if (icicle != null) {
        timeMillis = icicle.getLong(BUNDLE_KEY_RESTORE_TIME);
        viewType = icicle.getInt(BUNDLE_KEY_RESTORE_VIEW, -1);
    } else {
        String action = intent.getAction();
        if (Intent.ACTION_VIEW.equals(action)) {
            // Open EventInfo later
            timeMillis = parseViewAction(intent);
        }

        if (timeMillis == -1) {
            timeMillis = Utils.timeFromIntentInMillis(intent);
        }
    }

    if (viewType == -1 || viewType > ViewType.MAX_VALUE) {
        viewType = Utils.getViewTypeFromIntentAndSharedPref(this);
    }
    mTimeZone = Utils.getTimeZone(this, mHomeTimeUpdater);
    Time t = new Time(mTimeZone);
    t.set(timeMillis);

    if (DEBUG) {
        if (icicle != null && intent != null) {
            Log.d(TAG, "both, icicle:" + icicle.toString() + "  intent:" + intent.toString());
        } else {
            Log.d(TAG, "not both, icicle:" + icicle + " intent:" + intent);
        }
    }

    Resources res = getResources();
    mHideString = res.getString(R.string.hide_controls);
    mShowString = res.getString(R.string.show_controls);
    mOrientation = res.getConfiguration().orientation;
    if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        mControlsAnimateWidth = (int) res.getDimension(R.dimen.calendar_controls_width);
        if (mControlsParams == null) {
            mControlsParams = new LayoutParams(mControlsAnimateWidth, 0);
        }
        mControlsParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    } else {
        // Make sure width is in between allowed min and max width values
        mControlsAnimateWidth = Math.max(res.getDisplayMetrics().widthPixels * 45 / 100,
                (int) res.getDimension(R.dimen.min_portrait_calendar_controls_width));
        mControlsAnimateWidth = Math.min(mControlsAnimateWidth,
                (int) res.getDimension(R.dimen.max_portrait_calendar_controls_width));
    }

    mControlsAnimateHeight = (int) res.getDimension(R.dimen.calendar_controls_height);

    mHideControls = !Utils.getSharedPreference(this, GeneralPreferences.KEY_SHOW_CONTROLS, true);
    mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config);
    mIsTabletConfig = Utils.getConfigBool(this, R.bool.tablet_config);
    mShowAgendaWithMonth = Utils.getConfigBool(this, R.bool.show_agenda_with_month);
    mShowCalendarControls = Utils.getConfigBool(this, R.bool.show_calendar_controls);
    mShowEventDetailsWithAgenda = Utils.getConfigBool(this, R.bool.show_event_details_with_agenda);
    mShowEventInfoFullScreenAgenda = Utils.getConfigBool(this, R.bool.agenda_show_event_info_full_screen);
    mShowEventInfoFullScreen = Utils.getConfigBool(this, R.bool.show_event_info_full_screen);
    mCalendarControlsAnimationTime = res.getInteger(R.integer.calendar_controls_animation_time);
    Utils.setAllowWeekForDetailView(mIsMultipane);

    // setContentView must be called before configureActionBar
    setContentView(R.layout.all_in_one);

    if (mIsTabletConfig) {
        mDateRange = (TextView) findViewById(R.id.date_bar);
        mWeekTextView = (TextView) findViewById(R.id.week_num);
    } else {
        mDateRange = (TextView) getLayoutInflater().inflate(R.layout.date_range_title, null);
    }

    // configureActionBar auto-selects the first tab you add, so we need to
    // call it before we set up our own fragments to make sure it doesn't
    // overwrite us
    configureActionBar(viewType);

    mHomeTime = (TextView) findViewById(R.id.home_time);
    mMiniMonth = findViewById(R.id.mini_month);
    if (mIsTabletConfig && mOrientation == Configuration.ORIENTATION_PORTRAIT) {
        mMiniMonth.setLayoutParams(
                new RelativeLayout.LayoutParams(mControlsAnimateWidth, mControlsAnimateHeight));
    }
    mCalendarsList = findViewById(R.id.calendar_list);
    mMiniMonthContainer = findViewById(R.id.mini_month_container);
    mSecondaryPane = findViewById(R.id.secondary_pane);

    // Must register as the first activity because this activity can modify
    // the list of event handlers in it's handle method. This affects who
    // the rest of the handlers the controller dispatches to are.
    mController.registerFirstEventHandler(HANDLER_KEY, this);

    initFragments(timeMillis, viewType, icicle);

    // Listen for changes that would require this to be refreshed
    SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(this);

    mContentResolver = getContentResolver();
}

From source file:com.android.calendar.AllInOneActivity.java

@Override
protected void onCreate(Bundle icicle) {
    if (Utils.getSharedPreference(this, OtherPreferences.KEY_OTHER_1, false)) {
        setTheme(R.style.CalendarTheme_WithActionBarWallpaper);
    }/*from   w w w  .  j a v  a 2s. co  m*/
    super.onCreate(icicle);
    dynamicTheme.onCreate(this);

    if (icicle != null && icicle.containsKey(BUNDLE_KEY_CHECK_ACCOUNTS)) {
        mCheckForAccounts = icicle.getBoolean(BUNDLE_KEY_CHECK_ACCOUNTS);
    }
    // Launch add google account if this is first time and there are no
    // accounts yet
    if (mCheckForAccounts && !Utils.getSharedPreference(this, GeneralPreferences.KEY_SKIP_SETUP, false)) {

        mHandler = new QueryHandler(this.getContentResolver());
        mHandler.startQuery(0, null, Calendars.CONTENT_URI, new String[] { Calendars._ID }, null,
                null /* selection args */, null /* sort order */);
    }

    // This needs to be created before setContentView
    mController = CalendarController.getInstance(this);

    // Check and ask for most needed permissions
    checkAppPermissions();

    // Get time from intent or icicle
    long timeMillis = -1;
    int viewType = -1;
    final Intent intent = getIntent();
    if (icicle != null) {
        timeMillis = icicle.getLong(BUNDLE_KEY_RESTORE_TIME);
        viewType = icicle.getInt(BUNDLE_KEY_RESTORE_VIEW, -1);
    } else {
        String action = intent.getAction();
        if (Intent.ACTION_VIEW.equals(action)) {
            // Open EventInfo later
            timeMillis = parseViewAction(intent);
        }

        if (timeMillis == -1) {
            timeMillis = Utils.timeFromIntentInMillis(intent);
        }
    }

    if (viewType == -1 || viewType > ViewType.MAX_VALUE) {
        viewType = Utils.getViewTypeFromIntentAndSharedPref(this);
    }
    mTimeZone = Utils.getTimeZone(this, mHomeTimeUpdater);
    Time t = new Time(mTimeZone);
    t.set(timeMillis);

    if (DEBUG) {
        if (icicle != null && intent != null) {
            Log.d(TAG, "both, icicle:" + icicle.toString() + "  intent:" + intent.toString());
        } else {
            Log.d(TAG, "not both, icicle:" + icicle + " intent:" + intent);
        }
    }

    Resources res = getResources();
    mHideString = res.getString(R.string.hide_controls);
    mShowString = res.getString(R.string.show_controls);
    mOrientation = res.getConfiguration().orientation;
    if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        mControlsAnimateWidth = (int) res.getDimension(R.dimen.calendar_controls_width);
        if (mControlsParams == null) {
            mControlsParams = new LayoutParams(mControlsAnimateWidth, 0);
        }
        mControlsParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    } else {
        // Make sure width is in between allowed min and max width values
        mControlsAnimateWidth = Math.max(res.getDisplayMetrics().widthPixels * 45 / 100,
                (int) res.getDimension(R.dimen.min_portrait_calendar_controls_width));
        mControlsAnimateWidth = Math.min(mControlsAnimateWidth,
                (int) res.getDimension(R.dimen.max_portrait_calendar_controls_width));
    }

    mControlsAnimateHeight = (int) res.getDimension(R.dimen.calendar_controls_height);

    mHideControls = !Utils.getSharedPreference(this, GeneralPreferences.KEY_SHOW_CONTROLS, true);
    mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config);
    mIsTabletConfig = Utils.getConfigBool(this, R.bool.tablet_config);
    mShowAgendaWithMonth = Utils.getConfigBool(this, R.bool.show_agenda_with_month);
    mShowCalendarControls = Utils.getConfigBool(this, R.bool.show_calendar_controls);
    mShowEventDetailsWithAgenda = Utils.getConfigBool(this, R.bool.show_event_details_with_agenda);
    mShowEventInfoFullScreenAgenda = Utils.getConfigBool(this, R.bool.agenda_show_event_info_full_screen);
    mShowEventInfoFullScreen = Utils.getConfigBool(this, R.bool.show_event_info_full_screen);
    mCalendarControlsAnimationTime = res.getInteger(R.integer.calendar_controls_animation_time);
    Utils.setAllowWeekForDetailView(mIsMultipane);

    // setContentView must be called before configureActionBar
    setContentView(R.layout.all_in_one_material);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavigationView = (NavigationView) findViewById(R.id.navigation_view);

    mFab = (FloatingActionButton) findViewById(R.id.floating_action_button);

    if (mIsTabletConfig) {
        mDateRange = (TextView) findViewById(R.id.date_bar);
        mWeekTextView = (TextView) findViewById(R.id.week_num);
    } else {
        mDateRange = (TextView) getLayoutInflater().inflate(R.layout.date_range_title, null);
    }

    setupToolbar(viewType);
    setupNavDrawer();
    setupFloatingActionButton();

    mHomeTime = (TextView) findViewById(R.id.home_time);
    mMiniMonth = findViewById(R.id.mini_month);
    if (mIsTabletConfig && mOrientation == Configuration.ORIENTATION_PORTRAIT) {
        mMiniMonth.setLayoutParams(
                new RelativeLayout.LayoutParams(mControlsAnimateWidth, mControlsAnimateHeight));
    }
    mCalendarsList = findViewById(R.id.calendar_list);
    mMiniMonthContainer = findViewById(R.id.mini_month_container);
    mSecondaryPane = findViewById(R.id.secondary_pane);

    // Must register as the first activity because this activity can modify
    // the list of event handlers in it's handle method. This affects who
    // the rest of the handlers the controller dispatches to are.
    mController.registerFirstEventHandler(HANDLER_KEY, this);

    initFragments(timeMillis, viewType, icicle);

    // Listen for changes that would require this to be refreshed
    SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(this);

    mContentResolver = getContentResolver();
}

From source file:org.mozilla.gecko.GeckoApp.java

public void doRestart(String action) {
    Log.i(LOGTAG, "doRestart(\"" + action + "\")");
    try {/*from   w ww . j av  a2 s. c  o m*/
        Intent intent = new Intent(action);
        intent.setClassName(getPackageName(), getPackageName() + ".Restarter");
        /* TODO: addEnvToIntent(intent); */
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
        Log.i(LOGTAG, intent.toString());
        GeckoAppShell.killAnyZombies();
        startActivity(intent);
    } catch (Exception e) {
        Log.i(LOGTAG, "error doing restart", e);
    }
    finish();
    // Give the restart process time to start before we die
    GeckoAppShell.waitForAnotherGeckoProc();
}

From source file:com.allmycode.flags.other.MyActivityOther.java

public void go(View view) {
    Intent intent = new Intent();
    String targetActivityName = "com.allmycode.flags";
    String fromEditText = targetActivity.getText().toString().trim();
    String other = (fromEditText.contains("Other")) ? ".other" : "";
    targetActivityName += other;/*w  w  w  . j a v a 2 s  .co m*/
    targetActivityName += ".FlagsDemoActivity";
    targetActivityName += fromEditText;
    Log.i(CLASSNAME, "Target activity: >>" + targetActivityName + "<<");
    intent.setClassName("com.allmycode.flags" + other, targetActivityName);
    String allFlags = flags.getText().toString();
    int flagsValue = 0;
    if (allFlags != "" && allFlags != null) {

        TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter('|');
        splitter.setString(allFlags);
        boolean existErrors = false;
        for (String flagName : splitter) {

            Log.i(CLASSNAME, ">>" + flagName + "<<");

            flagName = flagName.trim();
            if (!flagName.equals("") && flagName != null) { // BARRY
                                                            // need
                                                            // both?
                if (isHex(flagName)) {
                    Log.i(CLASSNAME, flagName + " is hex");
                    flagsValue |= Integer.parseInt(flagName.substring(2), 16);
                } else if (isDec(flagName)) {
                    Log.i(CLASSNAME, flagName + " is decimal");
                    flagsValue |= Integer.parseInt(flagName);
                } else {
                    Field flagsField = null;
                    try {
                        Log.i(CLASSNAME, "About to do reflection>>" + flagName + "<<");
                        flagsField = Intent.class.getField(flagName);
                        Log.i(CLASSNAME, Integer.toString(flagsField.getInt(this)));
                        flagsValue |= flagsField.getInt(this);
                    } catch (SecurityException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    } catch (NoSuchFieldException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    } catch (IllegalAccessException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    }
                    try {
                        Log.i(CLASSNAME, Integer.toHexString(flagsValue));
                        if (flagsValue != 0) {
                            intent.addFlags(flagsValue);
                        }
                    } catch (IllegalArgumentException e) {
                        existErrors = true;
                        e.printStackTrace();
                    }
                }
            }
        }
        if (flagsValue != 0) {
            intent.addFlags(flagsValue);
        }
        intent.putExtra("existErrors", existErrors);

        Log.i(CLASSNAME, "About to start " + intent.toString());
        startActivity(intent);
    }
}

From source file:com.allmycode.flags.MyActivity.java

public void go(View view) {
    Intent intent = null;
    String targetActivityName = "com.allmycode.flags";
    intent = new Intent();
    String fromEditText = targetActivity.getText().toString().trim();
    String other = (fromEditText.contains("Other")) ? ".other" : "";
    targetActivityName += other;/*from  www . j av  a 2 s .  co  m*/
    targetActivityName += ".FlagsDemoActivity";
    targetActivityName += fromEditText;
    Log.i(CLASSNAME, "Target activity: >>" + targetActivityName + "<<");
    intent.setClassName("com.allmycode.flags" + other, targetActivityName);
    String allFlags = flags.getText().toString();
    int flagsValue = 0;
    if (allFlags != "" && allFlags != null) {

        TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter('|');
        splitter.setString(allFlags);
        boolean existErrors = false;
        for (String flagName : splitter) {

            Log.i(CLASSNAME, ">>" + flagName + "<<");

            flagName = flagName.trim();
            if (!flagName.equals("") && flagName != null) { // BARRY
                                                            // need
                                                            // both?
                if (isHex(flagName)) {
                    Log.i(CLASSNAME, flagName + " is hex");
                    flagsValue |= Integer.parseInt(flagName.substring(2), 16);
                } else if (isDec(flagName)) {
                    Log.i(CLASSNAME, flagName + " is decimal");
                    flagsValue |= Integer.parseInt(flagName);
                } else {
                    Field flagsField = null;
                    try {
                        Log.i(CLASSNAME, "About to do reflection>>" + flagName + "<<");
                        flagsField = Intent.class.getField(flagName);
                        Log.i(CLASSNAME, Integer.toString(flagsField.getInt(this)));
                        flagsValue |= flagsField.getInt(this);
                    } catch (SecurityException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    } catch (NoSuchFieldException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    } catch (IllegalAccessException ex) {
                        existErrors = true;
                        ex.printStackTrace();
                    }
                    try {
                        Log.i(CLASSNAME, Integer.toHexString(flagsValue));
                        if (flagsValue != 0) {
                            intent.addFlags(flagsValue);
                        }
                    } catch (IllegalArgumentException e) {
                        existErrors = true;
                        e.printStackTrace();
                    }
                }
            }
        }
        if (flagsValue != 0) {
            intent.addFlags(flagsValue);
        }
        intent.putExtra("existErrors", existErrors);

        Log.i(CLASSNAME, "About to start " + intent.toString());
        startActivity(intent);
    }
}

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

@Override
protected void onNewIntent(Intent intent) {
    Logger.LogDebug("New Intent! " + intent.toString());
    setIntent(intent);//from  w w w .  j a  v a 2 s .c om
    handleIntent(intent);
}

From source file:com.cognizant.trumobi.PersonaLauncher.java

@Override
public void startActivity(Intent intent) {
    // TODO Auto-generated method stub
    PersonaLog.d("PersonaLauncher", " -- startActivity ----");
    final ComponentName name = intent.getComponent();
    if (name != null) {
        PersonaLog.d("personalauncher", "updateCountersForPackage called from startactivity");
        updateCountersForPackage(name.getPackageName(), 0, 0, 0);
    }/*from www  .j  a v a2s  .c  o  m*/
    PersonaLog.d("personalauncher", "parameter passed is " + name.getPackageName());
    PersonaLog.d("personalauncher", "--------inside startactivity----- intent is " + intent.toString());
    try {
        super.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
        Toast.makeText(this, getString(R.string.activity_not_found) + "123", Toast.LENGTH_SHORT).show();
    } catch (SecurityException e) {
        Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
        PersonaLog.e(LOG_TAG,
                "PersonaLauncher does not have the permission to launch " + intent
                        + ". Make sure to create a MAIN intent-filter for the corresponding activity "
                        + "or use the exported attribute for this activity.",
                e);
    }
}

From source file:org.telepatch.ui.ChatActivity.java

@Override
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == 0) {
            Utilities.addMediaToGallery(currentPicturePath);
            SendMessagesHelper.prepareSendingPhoto(currentPicturePath, null, dialog_id);
            currentPicturePath = null;/*from  w  ww .j av a 2 s.  c  o m*/
        } else if (requestCode == 1) {
            if (data == null || data.getData() == null) {
                showAttachmentError();
                return;
            }
            SendMessagesHelper.prepareSendingPhoto(null, data.getData(), dialog_id);
        } else if (requestCode == 2) {
            String videoPath = null;
            if (data != null) {
                Uri uri = data.getData();
                boolean fromCamera = false;
                if (uri != null && uri.getScheme() != null) {
                    fromCamera = uri.getScheme().contains("file");
                } else if (uri == null) {
                    fromCamera = true;
                }
                if (fromCamera) {
                    if (uri != null) {
                        videoPath = uri.getPath();
                    } else {
                        videoPath = currentPicturePath;
                    }
                    Utilities.addMediaToGallery(currentPicturePath);
                    currentPicturePath = null;
                } else {
                    try {
                        videoPath = Utilities.getPath(uri);
                    } catch (Exception e) {
                        FileLog.e("tmessages", e);
                    }
                }
            }
            if (videoPath == null && currentPicturePath != null) {
                File f = new File(currentPicturePath);
                if (f.exists()) {
                    videoPath = currentPicturePath;
                }
                currentPicturePath = null;
            }
            if (Build.VERSION.SDK_INT >= 16) {
                if (paused) {
                    startVideoEdit = videoPath;
                } else {
                    openVideoEditor(videoPath, false);
                }
            } else {
                SendMessagesHelper.prepareSendingVideo(videoPath, 0, 0, 0, 0, null, dialog_id);
            }
        } else if (requestCode == 21) {
            if (data == null || data.getData() == null) {
                showAttachmentError();
                return;
            }
            String tempPath = Utilities.getPath(data.getData());
            String originalPath = tempPath;
            if (tempPath == null) {
                originalPath = data.toString();
                tempPath = MediaController.copyDocumentToCache(data.getData(), "file");
            }
            if (tempPath == null) {
                showAttachmentError();
                return;
            }
            SendMessagesHelper.prepareSendingDocument(tempPath, originalPath, dialog_id);
        }
    }
}