Example usage for android.app Activity startActivity

List of usage examples for android.app Activity startActivity

Introduction

In this page you can find the example usage for android.app Activity startActivity.

Prototype

@Override
public void startActivity(Intent intent) 

Source Link

Document

Same as #startActivity(Intent,Bundle) with no options specified.

Usage

From source file:com.patloew.countries.ui.base.navigator.BaseNavigator.java

@Override
public final void startActivity(@NonNull Class<? extends Activity> activityClass, Parcelable args) {
    Activity activity = getActivity();
    Intent intent = new Intent(activity, activityClass);
    if (args != null) {
        intent.putExtra(EXTRA_ARGS, args);
    }/*from  www.j  a  v  a2 s . c o m*/
    activity.startActivity(intent);
}

From source file:com.bellman.bible.android.control.page.PageControl.java

/** send the current verse via social applications installed on user's device
 *//* w  w  w .  j a va 2 s.  co  m*/
public void shareVerse(VerseRange verseRange) {
    try {
        Book book = getCurrentPageManager().getCurrentPage().getCurrentDocument();

        String text = verseRange.getName() + "\n"
                + SwordContentFacade.getInstance().getCanonicalText(book, verseRange);

        Intent sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.setType("text/plain");

        sendIntent.putExtra(Intent.EXTRA_TEXT, text);
        // subject is used when user chooses to send verse via e-mail
        sendIntent.putExtra(Intent.EXTRA_SUBJECT,
                CurrentActivityHolder.getInstance().getApplication().getText(R.string.share_verse_subject));

        Activity activity = CurrentActivityHolder.getInstance().getCurrentActivity();
        activity.startActivity(Intent.createChooser(sendIntent, activity.getString(R.string.share_verse)));

    } catch (Exception e) {
        Log.e(TAG, "Error sharing verse", e);
        Dialogs.getInstance().showErrorMsg("Error sharing verse");
    }
}

From source file:net.bible.android.control.page.PageControl.java

/** send the current verse via social applications installed on user's device
 *///  ww  w  .ja v  a2  s. c o m
public void shareVerse() {
    try {
        Book book = getCurrentPageManager().getCurrentPage().getCurrentDocument();
        Key key = getCurrentPageManager().getCurrentPage().getSingleKey();

        String text = key.getName() + "\n" + SwordContentFacade.getInstance().getCanonicalText(book, key);

        Intent sendIntent = new Intent(Intent.ACTION_SEND);
        sendIntent.setType("text/plain");

        sendIntent.putExtra(Intent.EXTRA_TEXT, text);
        // subject is used when user chooses to send verse via e-mail
        sendIntent.putExtra(Intent.EXTRA_SUBJECT,
                BibleApplication.getApplication().getText(R.string.share_verse_subject));

        Activity activity = CurrentActivityHolder.getInstance().getCurrentActivity();
        activity.startActivity(Intent.createChooser(sendIntent, activity.getString(R.string.share_verse)));

    } catch (Exception e) {
        Log.e(TAG, "Error sharing verse", e);
        Dialogs.getInstance().showErrorMsg("Error sharing verse");
    }
}

From source file:com.soomla.store.storefront.StorefrontController.java

public void openStore(Activity activity, IStorefrontAssets storefrontAssets) {
    StorefrontInfo.getInstance().initialize(storefrontAssets);

    Intent intent = new Intent(activity.getApplicationContext(), StorefrontActivity.class);
    activity.startActivity(intent);

    StoreEventHandlers.getInstance().addEventHandler(this);
}

From source file:com.dvn.vindecoder.ui.user.GetAllVehicalDetails.java

public static void displayPromptForEnablingGPS(final Activity activity) {

    final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;
    final String message = "Do you want open GPS setting?";

    builder.setMessage(message).setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface d, int id) {
            activity.startActivity(new Intent(action));
            d.dismiss();// ww  w.  j a  va 2 s. com
        }
    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface d, int id) {
            d.cancel();
        }
    });
    builder.create().show();
}

From source file:co.edu.uniajc.vtf.security.controller.CreateAccountController.java

public void navigateContent() {
    Activity loActivity = (Activity) coView;
    Intent loIntent = new Intent(loActivity, SwipeContentActivity.class)
            .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
    loActivity.startActivity(loIntent);
    ((Activity) coView).finish();/*from w  w w .j ava2s  .  c  o  m*/
}

From source file:Main.java

public static void openFeedback(Activity activity) {
    try {/*from  www  .  ja  va 2  s.  c  om*/
        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);
    }
}

From source file:ru.appsm.inapphelp.IAHHelpDesk.java

/**
 *
 * Open support for push data. Special cordova method.
 *
 * @param data//from ww w .j av  a 2 s .  c o  m
 * @param activity
 */
public static void OpenSupportForData(JSONObject data, Activity activity) {
    Log.i(TAG, "handle push");
    if (data != null && data.has("secretkey") && data.has("userid") && data.has("appkey") && data.has("appid")
            && data.has("email") && data.has("message") && data.has("title") && data.has("notId")
            && data.has("msgId")) {
        try {
            Intent notificationIntent = new Intent(activity.getApplicationContext(), IssueDetailActivity.class);
            notificationIntent.putExtra("fromPush", true);
            notificationIntent.putExtra("userid", data.getString("userid"));
            notificationIntent.putExtra("appid", data.getString("appid"));
            notificationIntent.putExtra("appkey", data.getString("appkey"));
            notificationIntent.putExtra("secretkey", data.getString("secretkey"));
            notificationIntent.putExtra("email", data.getString("email"));
            notificationIntent.putExtra("msgId", data.getString("msgId"));
            activity.startActivity(notificationIntent);
        } catch (JSONException e) {
            Log.i(TAG, "Fail to parse push data");
        }
    } else {
        Log.i(TAG, "Empty or wrong push data");
    }
}

From source file:com.bilibili.boxing.Boxing.java

/**
 * use to start raw image viewer./*from   w  w  w  . j  a va  2s . c  o  m*/
 *
 * @param viewMode {@link BoxingConfig.ViewMode}
 */
public void start(@NonNull Activity activity, BoxingConfig.ViewMode viewMode) {
    BoxingManager.getInstance().getBoxingConfig().withViewer(viewMode);
    activity.startActivity(mIntent);
}

From source file:com.tribalyte.plugin.myo.MyoApi.java

private void startScanActivity(final CallbackContext cbc) {
    cordova.getActivity().runOnUiThread(new Runnable() {
        public void run() {
            Activity ctx = cordova.getActivity();
            ctx.startActivity(new Intent(ctx, ScanActivity.class));
            logd("Test scan activity started");
            cbc.success();//from  ww w .ja v  a2s  .  c o m
        }
    });
}