List of usage examples for android.content Intent ACTION_MAIN
String ACTION_MAIN
To view the source code for android.content Intent ACTION_MAIN.
Click Source Link
From source file:info.papdt.blacklight.ui.statuses.SingleActivity.java
@Binded public void repost() { Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.setClass(this, RepostActivity.class); i.putExtra("msg", mMsg); startActivity(i);/*from w w w .ja v a2s .c om*/ }
From source file:com.owncloud.android.ui.activity.FileDisplayActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); // Log.d(TAG,"called first"); super.onCreate(savedInstanceState); // this calls onAccountChanged() // when ownCloud Account is valid // requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); if (AccountUtils.getCurrentOwnCloudAccount(getBaseContext()) != null) { Intent intent = new Intent(this, InitialPageActivity.class); startActivity(intent);//from ww w . j a v a2 s . c om } mHandler = new Handler(); // / bindings to transference services mUploadConnection = new ListServiceConnection(); mDownloadConnection = new ListServiceConnection(); bindService(new Intent(this, FileUploader.class), mUploadConnection, Context.BIND_AUTO_CREATE); bindService(new Intent(this, FileDownloader.class), mDownloadConnection, Context.BIND_AUTO_CREATE); shareNotifier = new NotificationCompat.Builder(this).setContentTitle("File Shared") .setSmallIcon(R.drawable.icon); Button shareButton = (Button) findViewById(R.id.shareItem); Intent fileShareIntent = new Intent(this, FileDisplayActivity.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, fileShareIntent, 0); shareNotifier.setContentIntent(pIntent); shareNotifier.setAutoCancel(true); notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); dataSource = new DbFriends(this); // ContentResolver.setIsSyncable(getAccount(), // AccountAuthenticator.AUTHORITY, 1); // ContentResolver.setSyncAutomatically(getAccount(), // AccountAuthenticator.AUTHORITY,true); // broadcast receiver that is called by the service which downloads the // files to the phone instantdownloadreceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String message = intent.getStringExtra("message"); instantDownloadFile(); // make the http request and update the ui to include the sharer // information // unregisterReceiver(instantdownloadreceiver); } }; // PIN CODE request ; best location is to decide, let's try this first if (getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_MAIN) && savedInstanceState == null) { requestPinCode(); } // / file observer Intent observer_intent = new Intent(this, FileObserverService.class); observer_intent.putExtra(FileObserverService.KEY_FILE_CMD, FileObserverService.CMD_INIT_OBSERVED_LIST); startService(observer_intent); // / Load of saved instance state if (savedInstanceState != null) { mWaitingToPreview = (OCFile) savedInstanceState .getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW); } else { mWaitingToPreview = null; } // / USER INTERFACE // Inflate and set the layout view setContentView(R.layout.files); mDualPane = getResources().getBoolean(R.bool.large_land_layout); mLeftFragmentContainer = findViewById(R.id.left_fragment_container); mRightFragmentContainer = findViewById(R.id.right_fragment_container); if (savedInstanceState == null) { createMinFragments(); } // Action bar setup mDirectories = new CustomArrayAdapter<String>(this, R.layout.sherlock_spinner_dropdown_item); getSupportActionBar().setHomeButtonEnabled(true); // mandatory since // Android ICS, // according to the // official // documentation setSupportProgressBarIndeterminateVisibility(false); // always AFTER // setContentView(...) // ; to work around // bug in its // implementation Log_OC.d(TAG, "onCreate() end"); }
From source file:org.catrobat.catroid.utils.StatusBarNotificationManager.java
public void showUploadRejectedNotification(int id, int statusCode, String serverAnswer, Bundle bundle) { NotificationData notificationData = notificationDataMap.get(id); if (notificationData == null) { Log.d(TAG, "NotificationData is null."); return;// w ww. j av a 2 s . co m } NotificationCompat.Builder notificationBuilder = notificationData.getNotificationBuilder(); notificationData.setNotificationTextDone(serverAnswer); Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); notificationBuilder.setContentTitle(context.getResources().getText(R.string.notification_upload_rejected)) .setContentText(serverAnswer) .setTicker(context.getResources().getText(R.string.notification_upload_rejected)) .setSound(alarmSound).setStyle(new NotificationCompat.BigTextStyle().bigText(serverAnswer)) .setProgress(0, 0, false).setAutoCancel(true).setPriority(Notification.PRIORITY_MAX) .setOngoing(false); switch (statusCode) { case Constants.STATUS_CODE_INTERNAL_SERVER_ERROR: case Constants.STATUS_CODE_UPLOAD_MISSING_DATA: case Constants.STATUS_CODE_UPLOAD_INVALID_CHECKSUM: case Constants.STATUS_CODE_UPLOAD_COPY_FAILED: case Constants.STATUS_CODE_UPLOAD_UNZIP_FAILED: case Constants.STATUS_CODE_UPLOAD_MISSING_XML: case Constants.STATUS_CODE_UPLOAD_RENAME_FAILED: case Constants.STATUS_CODE_UPLOAD_SAVE_THUMBNAIL_FAILED: Intent actionIntentRetryUpload = new Intent(context, NotificationActionService.class) .setAction(ACTION_RETRY_UPLOAD); actionIntentRetryUpload.putExtra("bundle", bundle); PendingIntent actionPendingIntentRetryUpload = PendingIntent.getService(context, id, actionIntentRetryUpload, PendingIntent.FLAG_CANCEL_CURRENT); notificationBuilder.addAction(android.R.drawable.ic_popup_sync, context.getResources().getString(R.string.notification_upload_retry), actionPendingIntentRetryUpload); Intent actionIntentCancelUpload = new Intent(context, NotificationActionService.class) .setAction(ACTION_CANCEL_UPLOAD); actionIntentCancelUpload.putExtra("bundle", bundle); PendingIntent actionPendingIntentCancelUpload = PendingIntent.getService(context, id, actionIntentCancelUpload, PendingIntent.FLAG_ONE_SHOT); notificationBuilder.addAction(android.R.drawable.ic_menu_close_clear_cancel, context.getResources().getString(R.string.cancel_button), actionPendingIntentCancelUpload); break; case Constants.STATUS_CODE_UPLOAD_MISSING_CHECKSUM: case Constants.STATUS_CODE_UPLOAD_OLD_CATROBAT_LANGUAGE: case Constants.STATUS_CODE_UPLOAD_OLD_CATROBAT_VERSION: Intent actionIntentUpdatePocketCodeVersion = new Intent(context, NotificationActionService.class) .setAction(ACTION_UPDATE_POCKET_CODE_VERSION).putExtra("notificationId", id); PendingIntent actionPendingIntentUpdatePocketCodeVersion = PendingIntent.getService(context, id, actionIntentUpdatePocketCodeVersion, PendingIntent.FLAG_ONE_SHOT); notificationBuilder.addAction(R.drawable.ic_launcher, context.getResources().getString(R.string.notification_open_play_store), actionPendingIntentUpdatePocketCodeVersion); break; default: notificationDataMap.put(id, notificationData); Intent openIntent = new Intent(context, MainMenuActivity.class); openIntent.setAction(Intent.ACTION_MAIN).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) .putExtra(EXTRA_PROJECT_NAME, bundle.getString("projectName")); PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationId, openIntent, PendingIntent.FLAG_CANCEL_CURRENT); notificationData.setPendingIntent(pendingIntent); showOrUpdateNotification(id, MAXIMUM_PERCENT); return; } notificationBuilder.setContentIntent(notificationData.getPendingIntent()); notificationDataMap.put(id, notificationData); notificationManager.notify(id, notificationBuilder.build()); }
From source file:com.vyasware.vaani.MainActivity.java
private void doOpen(String[] sentence) { System.out.println("open"); for (String word : sentence) { switch (word) { //? ??? case "?": case "facebook": //open facebook Intent fbintent = new Intent(); fbintent.setAction(Intent.ACTION_VIEW); fbintent.setData(android.net.Uri.parse("http://www.facebook.com")); startActivity(fbintent);//from w ww.jav a2 s . c o m break; case "whatsapp": case "???": //todo run whatsapp break; case "camera": case "": case "": //open camera Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); try { PackageManager pm = getPackageManager(); final ResolveInfo mInfo = pm.resolveActivity(i, 0); Intent intent = new Intent(); intent.setComponent(new ComponentName(mInfo.activityInfo.packageName, mInfo.activityInfo.name)); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(intent); } catch (Exception e) { Log.i("open", "Unable to launch camera: " + e); } break; case "browser": case "?": // open browser Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(android.net.Uri.parse("http://www.google.com")); startActivity(intent); break; case "youtube": case "???": //run youtube Intent ytintent = new Intent(); ytintent.setAction(Intent.ACTION_VIEW); ytintent.setData(android.net.Uri.parse("http://www.youtube.com")); startActivity(ytintent); break; } } }
From source file:io.selendroid.server.ServerInstrumentation.java
public void backgroundActivity() { activitiesReporter.setBackgroundActivity(activitiesReporter.getCurrentActivity()); Intent homeIntent = new Intent(Intent.ACTION_MAIN); homeIntent.addCategory(Intent.CATEGORY_HOME); homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getTargetContext().startActivity(homeIntent); }
From source file:com.andernity.launcher2.InstallShortcutReceiver.java
private static boolean installShortcut(Context context, Intent data, ArrayList<ItemInfo> items, String name, final Intent intent, final int screen, boolean shortcutExists, final SharedPreferences sharedPrefs, int[] result) { int[] tmpCoordinates = new int[2]; if (findEmptyCell(context, items, tmpCoordinates, screen)) { if (intent != null) { if (intent.getAction() == null) { intent.setAction(Intent.ACTION_VIEW); } else if (intent.getAction().equals(Intent.ACTION_MAIN) && intent.getCategories() != null && intent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); }//from w ww.j a v a2s. c om // By default, we allow for duplicate entries (located in // different places) boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true); if (duplicate || !shortcutExists) { new Thread("setNewAppsThread") { public void run() { synchronized (sLock) { // If the new app is going to fall into the same page as before, // then just continue adding to the current page final int newAppsScreen = sharedPrefs.getInt(NEW_APPS_PAGE_KEY, screen); SharedPreferences.Editor editor = sharedPrefs.edit(); if (newAppsScreen == -1 || newAppsScreen == screen) { addToStringSet(sharedPrefs, editor, NEW_APPS_LIST_KEY, intent.toUri(0)); } editor.putInt(NEW_APPS_PAGE_KEY, screen); editor.commit(); } } }.start(); // Update the Launcher db LauncherApplication app = (LauncherApplication) context.getApplicationContext(); ShortcutInfo info = app.getModel().addShortcut(context, data, LauncherSettings.Favorites.CONTAINER_DESKTOP, screen, tmpCoordinates[0], tmpCoordinates[1], true); if (info == null) { return false; } } else { result[0] = INSTALL_SHORTCUT_IS_DUPLICATE; } return true; } } else { result[0] = INSTALL_SHORTCUT_NO_SPACE; } return false; }
From source file:org.wso2.mdm.agent.AlreadyRegisteredActivity.java
/** * Load device home screen.//from w ww. j a v a 2 s .c o m */ private void loadHomeScreen() { Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_HOME); this.startActivity(i); super.onBackPressed(); }
From source file:free.yhc.netmbuddy.utils.Utils.java
public static void resumeApp() { Intent intent = new Intent(Utils.getAppContext(), YTMPActivity.class); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Utils.getAppContext().startActivity(intent); }
From source file:org.onepf.oms.appstore.SamsungAppsBillingService.java
@Override public void launchPurchaseFlow(Activity activity, String sku, String itemType, int requestCode, OnIabPurchaseFinishedListener listener, String extraData) { String itemGroupId = getItemGroupId(sku); String itemId = getItemId(sku); Bundle bundle = new Bundle(); bundle.putString(KEY_NAME_THIRD_PARTY_NAME, activity.getPackageName()); bundle.putString(KEY_NAME_ITEM_GROUP_ID, itemGroupId); bundle.putString(KEY_NAME_ITEM_ID, itemId); if (isDebugLog()) Log.d(TAG, "launchPurchase: itemGroupId = " + itemGroupId + ", itemId = " + itemId); ComponentName cmpName = new ComponentName(SamsungApps.IAP_PACKAGE_NAME, PAYMENT_ACTIVITY_NAME); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(cmpName);// ww w . ja v a 2 s . c om intent.putExtras(bundle); mRequestCode = requestCode; mPurchaseListener = listener; purchasingItemType = itemType; mItemGroupId = itemGroupId; mExtraData = extraData; if (isDebugLog()) Log.d(TAG, "Request code: " + requestCode); activity.startActivityForResult(intent, requestCode); }
From source file:cl.iluminadoschile.pako.floatingdiv.CustomOverlayService.java
@Override protected Notification foregroundNotification(int notificationId) { Notification notification;/* www . ja va 2 s . c o m*/ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && activation_method.equals(Constants.SETTINGS.ACTIVATION_METHOD_MANUAL)) { Intent settingsIntent = new Intent(Intent.ACTION_MAIN); settingsIntent.setClassName(Constants.ACTION.prefix, Constants.ACTION.prefix + ".SettingsActivity"); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, settingsIntent, 0); Intent startFgIntent = new Intent(this, CustomOverlayService.class); startFgIntent.setAction(Constants.ACTION.STARTFOREGROUND_ACTION); PendingIntent pstartFgIntent = PendingIntent.getService(this, 0, startFgIntent, 0); Intent pauseFgIntent = new Intent(this, CustomOverlayService.class); pauseFgIntent.setAction(Constants.ACTION.PAUSEFOREGROUND_ACTION); PendingIntent ppauseFgIntent = PendingIntent.getService(this, 0, pauseFgIntent, 0); Intent stopFgIntent = new Intent(this, CustomOverlayService.class); stopFgIntent.setAction(Constants.ACTION.STOPFOREGROUND_ACTION); PendingIntent pstopFgIntent = PendingIntent.getService(this, 0, stopFgIntent, 0); Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); notification = new NotificationCompat.Builder(this) .setContentTitle(getString(R.string.title_notification)) .setTicker(getString(R.string.title_notification)) .setContentText(getString(R.string.message_notification)).setSmallIcon(R.drawable.ic_launcher) .setLargeIcon(Bitmap.createScaledBitmap(icon, 128, 128, false)).setContentIntent(pendingIntent) .setOngoing(true).addAction(android.R.drawable.ic_media_play, "Start", pstartFgIntent) .addAction(android.R.drawable.ic_media_pause, "Pause", ppauseFgIntent) .addAction(android.R.drawable.ic_delete, "Stop", pstopFgIntent).build(); } else { notification = new Notification(R.drawable.ic_launcher, getString(R.string.title_notification), System.currentTimeMillis()); notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT | Notification.FLAG_ONLY_ALERT_ONCE; notification.setLatestEventInfo(this, getString(R.string.title_notification), getString(R.string.message_notification_manual), notificationIntent()); } return notification; }