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:co.edu.uniajc.vtf.content.controller.PoiDetailController.java

public void navigateToRouteMap() {
    Activity loActivity = ((Activity) this.coView);
    Intent loIntent = new Intent(loActivity, NavigationActivity.class);
    Bundle loBundle = new Bundle();
    loBundle.putParcelable("destiny", this.coView.getPoiData());
    loIntent.putExtras(loBundle);//from   w  w w.jav a 2  s.  c  o m
    loActivity.startActivity(loIntent);
}

From source file:com.erevacation.challenge.ui.base.navigator.BaseNavigator.java

@Override
public final void startActivity(@NonNull Class<? extends Activity> activityClass, Bundle args) {
    Activity activity = getActivity();
    Intent intent = new Intent(activity, activityClass);
    if (args != null) {
        intent.putExtra(EXTRA_ARGS, args);
    }/*  ww w .  j  av  a  2  s.  c  o m*/
    activity.startActivity(intent);
    mActivityAnimations.apply(getActivity());
}

From source file:com.erevacation.challenge.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);
    }//  w  w  w .j a va2  s  .  c om
    activity.startActivity(intent);
    mActivityAnimations.apply(getActivity());
}

From source file:de.ub0r.android.lib.DonationHelper.java

/**
 * Show "donate" dialog./*from w ww  .ja  v  a2s. c o  m*/
 * 
 * @param context
 *            {@link Context}
 * @param title
 *            title
 * @param btnDonate
 *            button text for donate
 * @param btnNoads
 *            button text for "i did a donation"
 * @param messages
 *            messages for dialog body
 */
public static void showDonationDialog(final Activity context, final String title, final String btnDonate,
        final String btnNoads, final String[] messages) {
    final Intent marketIntent = Market.getInstallAppIntent(context, DONATOR_PACKAGE, null);

    String btnTitle = String.format(btnDonate, "Play Store");

    SpannableStringBuilder sb = new SpannableStringBuilder();
    for (String m : messages) {
        sb.append(m);
        sb.append("\n");
    }
    sb.delete(sb.length() - 1, sb.length());
    sb.setSpan(new RelativeSizeSpan(0.75f), 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    AlertDialog.Builder b = new AlertDialog.Builder(context);
    b.setTitle(title);
    b.setMessage(sb);
    b.setCancelable(true);
    b.setPositiveButton(btnTitle, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            try {
                context.startActivity(marketIntent);
            } catch (ActivityNotFoundException e) {
                Log.e(TAG, "activity not found", e);
                Toast.makeText(context, "activity not found", Toast.LENGTH_LONG).show();
            }
        }
    });
    b.setNeutralButton(btnNoads, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            try {
                context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
                        "http://code.google.com/p/ub0rapps/downloads/list?" + "can=3&q=Product%3DDonator")));
            } catch (ActivityNotFoundException e) {
                Log.e(TAG, "activity not found", e);
                Toast.makeText(context, "activity not found", Toast.LENGTH_LONG).show();
            }
        }
    });
    b.show();
}

From source file:com.mercandalli.android.apps.files.user.ConversationUserModel.java

public void open(final Activity activity) {
    final Intent intent = new Intent(activity, ConversationActivity.class);
    intent.putExtra("LOGIN", "" + Config.getUser().getAccessLogin());
    intent.putExtra("PASSWORD", "" + Config.getUser().getAccessPassword());
    intent.putExtra("ID_CONVERSATION", "" + this.id_conversation);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.left_in, R.anim.left_out);
}

From source file:de.geeksfactory.opacclient.OpacClient.java

public void openAccountList(Activity ctx) {
    Intent intent = new Intent(ctx, AccountListActivity.class);
    ctx.startActivity(intent);
}

From source file:com.amaze.carbonfilemanager.activities.PreferencesActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // Navigate "up" the demo structure to the launchpad activity.
        if (selectedItem != START_PREFERENCE && changed)
            restartPC(this);
        else if (selectedItem != START_PREFERENCE) {
            selectItem(START_PREFERENCE);
        } else {/*from  w w  w .  java 2  s  . co m*/
            Intent in = new Intent(PreferencesActivity.this, MainActivity.class);
            in.setAction(Intent.ACTION_MAIN);
            in.setAction(Intent.CATEGORY_LAUNCHER);

            final int enter_anim = android.R.anim.fade_in;
            final int exit_anim = android.R.anim.fade_out;
            Activity activity = this;
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.finish();
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.startActivity(in);
        }
        return true;
    }
    return true;
}

From source file:de.geeksfactory.opacclient.OpacClient.java

public void addFirstAccount(Activity activity) {
    Intent intent = new Intent(activity, WelcomeActivity.class);
    activity.startActivity(intent);
    activity.finish();
}

From source file:com.miz.utils.ViewUtils.java

/**
 * Returns a actor card with name, character, image and click listener.
 * @param context//ww  w.ja  v  a2 s .  com
 * @param picasso
 * @param actor
 * @return
 */
@SuppressLint("InflateParams")
public static View setupActorCard(final Activity context, Picasso picasso, final Actor actor) {
    View v = LayoutInflater.from(context).inflate(R.layout.horizontal_grid_item_small, null);

    // Load image
    picasso.load(actor.getUrl()).placeholder(R.color.card_background_dark).error(R.drawable.noactor)
            .config(MizuuApplication.getBitmapConfig()).into(((ImageView) v.findViewById(R.id.cover)));

    // Set title
    ((TextView) v.findViewById(R.id.text)).setText(actor.getName());
    ((TextView) v.findViewById(R.id.text)).setTypeface(TypefaceUtils.getRobotoMedium(context));

    // Set subtitle
    ((TextView) v.findViewById(R.id.gridCoverSubtitle)).setText(actor.getCharacter());
    ((TextView) v.findViewById(R.id.gridCoverSubtitle)).setSingleLine(true);

    // Set click listener
    v.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            context.startActivity(IntentUtils.getActorIntent(context, actor));
        }
    });

    return v;
}

From source file:de.geeksfactory.opacclient.OpacClient.java

public void toPrefs(Activity activity) {
    Intent intent = new Intent(activity, MainPreferenceActivity.class);
    activity.startActivity(intent);
}