List of usage examples for android.app Activity startActivity
@Override public void startActivity(Intent intent)
From source file:Main.java
public static void addToCalendar(Activity context, Long beginTime, String title) { ContentResolver cr = context.getContentResolver(); Uri.Builder builder = Uri.parse("content://com.android.calendar/instances/when").buildUpon(); Long time = new Date(beginTime).getTime(); ContentUris.appendId(builder, time - 10 * 60 * 1000); ContentUris.appendId(builder, time + 10 * 60 * 1000); String[] projection = new String[] { "title", "begin" }; Cursor cursor = cr.query(builder.build(), projection, null, null, null); boolean exists = false; if (cursor != null) { while (cursor.moveToNext()) { if ((time == cursor.getLong(1)) && title.equals(cursor.getString(0))) { exists = true;/*from ww w . j a va 2 s .co m*/ } } } if (!exists) { Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", time); intent.putExtra("allDay", false); intent.putExtra("endTime", time + 60 * 60 * 1000); intent.putExtra("title", title); context.startActivity(intent); } else { Toast.makeText(context, "Event already exist!", Toast.LENGTH_LONG).show(); } }
From source file:com.apptentive.android.sdk.module.messagecenter.ApptentiveMessageCenter.java
protected static void show(Activity activity) { SharedPreferences prefs = activity.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); Configuration conf = Configuration.load(activity); boolean enableMessageCenter = conf.isMessageCenterEnabled(activity); boolean emailRequired = conf.isMessageCenterEmailRequired(activity); boolean shouldShowIntroDialog = !enableMessageCenter || prefs.getBoolean(Constants.PREF_KEY_MESSAGE_CENTER_SHOULD_SHOW_INTRO_DIALOG, true); // TODO: What if there is an incoming message that is unread? Shouldn't they see the Message Center right away? if (shouldShowIntroDialog) { showIntroDialog(activity, emailRequired); } else {/*from w w w .j a v a2 s. co m*/ Intent intent = new Intent(); intent.setClass(activity, ViewActivity.class); intent.putExtra(ActivityContent.KEY, ActivityContent.Type.MESSAGE_CENTER.toString()); activity.startActivity(intent); activity.overridePendingTransition(R.anim.slide_up_in, R.anim.slide_down_out); } }
From source file:com.android.tv.dvr.ui.DvrUiHelper.java
/** * Shows DVR no free space error dialog. * * @param recordingRequestRunnable the recording request to be executed when users choose * {@link DvrGuidedStepFragment#ACTION_RECORD_ANYWAY}. *///from w ww .j a v a 2s . co m public static void showDvrNoFreeSpaceErrorDialog(Activity activity, Runnable recordingRequestRunnable) { DvrHalfSizedDialogFragment fragment = new DvrNoFreeSpaceErrorDialogFragment(); fragment.setOnActionClickListener(new HalfSizedDialogFragment.OnActionClickListener() { @Override public void onActionClick(long actionId) { if (actionId == DvrGuidedStepFragment.ACTION_RECORD_ANYWAY) { recordingRequestRunnable.run(); } else if (actionId == DvrGuidedStepFragment.ACTION_DELETE_RECORDINGS) { Intent intent = new Intent(activity, DvrBrowseActivity.class); activity.startActivity(intent); } } }); showDialogFragment(activity, fragment, null); }
From source file:co.edu.uniajc.vtf.content.controller.PoiDetailController.java
public void navigateToImageView(PointOfInterestEntity pData) { ExtendedApplicationContext loContext = (ExtendedApplicationContext) ((Activity) this.coView) .getApplication();//w w w .ja va2 s . c o m loContext.setData(pData.getImage()); Activity loActivity = ((Activity) this.coView); Intent loIntent = new Intent(loActivity, PoiImageActivity.class); loActivity.startActivity(loIntent); }
From source file:co.edu.uniajc.vtf.security.controller.LoginController.java
public void navigateForgotPassword() { Activity loActivity = (Activity) this.coView; Intent loIntent = new Intent((Activity) this.coView, ForgotPasswordActivity.class); loActivity.startActivity(loIntent); }
From source file:com.bilibili.boxing.Boxing.java
/** * same as {@link Activity#startActivity(Intent)} */ public void start(@NonNull Activity activity) { activity.startActivity(mIntent); }
From source file:co.edu.uniajc.vtf.content.controller.ListSitesController.java
public void navigatePoiDetail(int pPoiId) { Activity loActivity = ((Fragment) this.coView).getActivity(); Intent loIntent = new Intent(loActivity, PoiDetailActivity.class); loIntent.putExtra("id", pPoiId); loActivity.startActivity(loIntent); }
From source file:co.edu.uniajc.vtf.content.controller.PoiDetailController.java
public void navigateComments(int pPoiId) { Activity loActivity = ((Activity) this.coView); Intent loIntent = new Intent(loActivity, CommentsActivity.class); loIntent.putExtra("id", pPoiId); loActivity.startActivity(loIntent); }
From source file:Main.java
public static void startActivity(final Activity thisActivity, final Intent intent, final View triggerView, int colorOrImageRes, final long durationMills) { int[] location = new int[2]; triggerView.getLocationInWindow(location); final int cx = location[0] + triggerView.getWidth(); final int cy = location[1] + triggerView.getHeight() + (int) TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 160, thisActivity.getResources().getDisplayMetrics()); final ImageView view = new ImageView(thisActivity); view.setScaleType(ImageView.ScaleType.CENTER_CROP); view.setImageResource(colorOrImageRes); final ViewGroup decorView = (ViewGroup) thisActivity.getWindow().getDecorView(); int w = decorView.getWidth(); int h = decorView.getHeight(); decorView.addView(view, w, h);//from w w w . jav a 2 s . co m final int finalRadius = (int) Math.sqrt(w * w + h * h) + 1; Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); anim.setDuration(durationMills); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); thisActivity.startActivity(intent); thisActivity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); anim.start(); }
From source file:com.patloew.countries.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); }//from ww w . j ava 2 s. c o m activity.startActivity(intent); }