List of usage examples for android.content Intent addCategory
public @NonNull Intent addCategory(String category)
From source file:com.flipzu.flipzu.Player.java
private boolean isScreenReaderActive() { // Restrict the set of intents to only accessibility services that have // the category FEEDBACK_SPOKEN (aka, screen readers). Intent screenReaderIntent = new Intent(SCREENREADER_INTENT_ACTION); screenReaderIntent.addCategory(SCREENREADER_INTENT_CATEGORY); List<ResolveInfo> screenReaders = getPackageManager().queryIntentServices(screenReaderIntent, 0); ContentResolver cr = getContentResolver(); Cursor cursor = null;//from ww w . j av a 2 s . co m int status = 0; for (ResolveInfo screenReader : screenReaders) { // All screen readers are expected to implement a content provider // that responds to // content://<nameofpackage>.providers.StatusProvider cursor = cr.query( Uri.parse("content://" + screenReader.serviceInfo.packageName + ".providers.StatusProvider"), null, null, null, null); if (cursor != null) { cursor.moveToFirst(); // These content providers use a special cursor that only has // one element, // an integer that is 1 if the screen reader is running. status = cursor.getInt(0); cursor.close(); if (status == 1) { return true; } } } return false; }
From source file:com.fa.mastodon.activity.ComposeActivity.java
private void initiateMediaPicking() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { intent.setType("image/* video/*"); } else {//from w ww . ja va 2 s. c om String[] mimeTypes = new String[] { "image/*", "video/*" }; intent.setType("*/*"); intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); } startActivityForResult(intent, MEDIA_PICK_RESULT); }
From source file:com.partypoker.poker.engagement.reach.EngagementReachAgent.java
/** * Show or refresh loading activity.//from w w w. ja v a 2s. c o m * @param content campaign being loaded. * @param flags additional activity flags. */ private void showOrRefreshLoading(EngagementReachContent content, int... flags) { Intent intent = new Intent(INTENT_ACTION_LOADING); String category = content.getCategory(); if (category != null) intent.addCategory(category); filterIntentWithCategory(intent); setContentIdExtra(intent, content); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); for (int flag : flags) intent.addFlags(flag); mContext.startActivity(intent); }
From source file:com.kdao.cmpe235_project.UploadActivity.java
private void initUI() { /**// www .j a v a 2s .c o m * This adapter takes the data in transferRecordMaps and displays it, * with the keys of the map being related to the columns in the adapter */ simpleAdapter = new SimpleAdapter(this, transferRecordMaps, R.layout.record_item, new String[] { "checked", "fileName", "progress", "bytes", "state", "percentage" }, new int[] { R.id.radioButton1, R.id.textFileName, R.id.progressBar1, R.id.textBytes, R.id.textState, R.id.textPercentage }); simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { switch (view.getId()) { case R.id.radioButton1: RadioButton radio = (RadioButton) view; radio.setChecked((Boolean) data); return true; case R.id.textFileName: TextView fileName = (TextView) view; fileName.setText((String) data); return true; case R.id.progressBar1: ProgressBar progress = (ProgressBar) view; progress.setProgress((Integer) data); return true; case R.id.textBytes: TextView bytes = (TextView) view; bytes.setText((String) data); return true; case R.id.textState: TextView state = (TextView) view; state.setText(((TransferState) data).toString()); return true; case R.id.textPercentage: TextView percentage = (TextView) view; percentage.setText((String) data); return true; } return false; } }); setListAdapter(simpleAdapter); // Updates checked index when an item is clicked getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) { if (checkedIndex != pos) { transferRecordMaps.get(pos).put("checked", true); if (checkedIndex >= 0) { transferRecordMaps.get(checkedIndex).put("checked", false); } checkedIndex = pos; updateButtonAvailability(); simpleAdapter.notifyDataSetChanged(); } } }); //btnUploadFile = (Button) findViewById(R.id.buttonUploadFile); btnUploadImage = (Button) findViewById(R.id.buttonUploadImage); btnUploadAudio = (Button) findViewById(R.id.buttonUploadAudio); btnUploadVideo = (Button) findViewById(R.id.buttonUploadVideo); btnPause = (Button) findViewById(R.id.buttonPause); btnResume = (Button) findViewById(R.id.buttonResume); btnCancel = (Button) findViewById(R.id.buttonCancel); btnDelete = (Button) findViewById(R.id.buttonDelete); btnPauseAll = (Button) findViewById(R.id.buttonPauseAll); btnCancelAll = (Button) findViewById(R.id.buttonCancelAll); btnUploadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (isTreeSelected) { System.out.println(">>>>> Start uploading photos... <<<<<<<"); Intent intent = new Intent(); if (Build.VERSION.SDK_INT >= 19) { // For Android versions of KitKat or later, we use a // different intent to ensure // we can get the file path from the returned intent URI intent.setAction(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); } else { intent.setAction(Intent.ACTION_GET_CONTENT); } APIurl = "/tree/" + treeId + "/photo"; intent.setType("image/*"); startActivityForResult(intent, 0); } else { Toast.makeText(getApplicationContext(), Config.UPLOAD_NOTREE_ERR, Toast.LENGTH_LONG).show(); } } }); btnUploadAudio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (isTreeSelected) { Intent intent = new Intent(); if (Build.VERSION.SDK_INT >= 19) { // For Android versions of KitKat or later, we use a // different intent to ensure // we can get the file path from the returned intent URI intent.setAction(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); } else { intent.setAction(Intent.ACTION_GET_CONTENT); } APIurl = "/tree/" + treeId + "/audio"; intent.setType("audio/*"); startActivityForResult(intent, 0); } else { Toast.makeText(getApplicationContext(), Config.UPLOAD_NOTREE_ERR, Toast.LENGTH_LONG).show(); } } }); btnUploadVideo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (isTreeSelected) { Intent intent = new Intent(); if (Build.VERSION.SDK_INT >= 19) { // For Android versions of KitKat or later, we use a // different intent to ensure // we can get the file path from the returned intent URI intent.setAction(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); } else { intent.setAction(Intent.ACTION_GET_CONTENT); } APIurl = "/tree/" + treeId + "/video"; intent.setType("video/*"); startActivityForResult(intent, 0); } else { Toast.makeText(getApplicationContext(), Config.UPLOAD_NOTREE_ERR, Toast.LENGTH_LONG).show(); } } }); btnPause.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Make sure the user has selected a transfer if (checkedIndex >= 0 && checkedIndex < observers.size()) { Boolean paused = transferUtility.pause(observers.get(checkedIndex).getId()); /** * If paused does not return true, it is likely because the * user is trying to pause an upload that is not in a * pausable state (For instance it is already paused, or * canceled). */ if (!paused) { Toast.makeText(UploadActivity.this, Config.UPLOAD_PAUSE_ERR, Toast.LENGTH_SHORT).show(); } } } }); btnResume.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Make sure the user has selected a transfer if (checkedIndex >= 0 && checkedIndex < observers.size()) { TransferObserver resumed = transferUtility.resume(observers.get(checkedIndex).getId()); // Sets a new transfer listener to the original observer. // This will overwrite existing listener. observers.get(checkedIndex).setTransferListener(new UploadListener()); /** * If resume returns null, it is likely because the transfer * is not in a resumable state (For instance it is already * running). */ if (resumed == null) { Toast.makeText(UploadActivity.this, Config.UPLOAD_RESUME_ERR, Toast.LENGTH_SHORT).show(); } } } }); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Make sure a transfer is selected if (checkedIndex >= 0 && checkedIndex < observers.size()) { Boolean canceled = transferUtility.cancel(observers.get(checkedIndex).getId()); /** * If cancel returns false, it is likely because the * transfer is already canceled */ if (!canceled) { Toast.makeText(UploadActivity.this, Config.UPLOAD_TRANSFER_ERR, Toast.LENGTH_SHORT).show(); } } } }); btnDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Make sure a transfer is selected if (checkedIndex >= 0 && checkedIndex < observers.size()) { transferUtility.deleteTransferRecord(observers.get(checkedIndex).getId()); observers.remove(checkedIndex); transferRecordMaps.remove(checkedIndex); checkedIndex = INDEX_NOT_CHECKED; updateButtonAvailability(); updateList(); } } }); btnPauseAll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { transferUtility.pauseAllWithType(TransferType.UPLOAD); } }); btnCancelAll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { transferUtility.cancelAllWithType(TransferType.UPLOAD); } }); updateButtonAvailability(); }
From source file:ar.com.tristeslostrestigres.diasporanativewebapp.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progressBar = findViewById(R.id.progressBar); pm = new PrefManager(MainActivity.this); SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE); podDomain = config.getString("podDomain", null); fab = findViewById(R.id.multiple_actions); fab.setVisibility(View.GONE); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar);//www . jav a2 s. co m getSupportActionBar().setTitle(null); txtTitle = (TextView) findViewById(R.id.toolbar_title); txtTitle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (Helpers.isOnline(MainActivity.this)) { txtTitle.setText(R.string.jb_stream); webView.loadUrl("https://" + podDomain + "/stream"); } else { Snackbar.make(v, R.string.no_internet, Snackbar.LENGTH_SHORT).show(); } } }); webView = findViewById(R.id.webView); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.addJavascriptInterface(new JavaScriptInterface(), "NotificationCounter"); if (savedInstanceState != null) { webView.restoreState(savedInstanceState); } wSettings = webView.getSettings(); wSettings.setJavaScriptEnabled(true); wSettings.setUseWideViewPort(true); wSettings.setLoadWithOverviewMode(true); wSettings.setDomStorageEnabled(true); wSettings.setMinimumFontSize(pm.getMinimumFontSize()); wSettings.setLoadsImagesAutomatically(pm.getLoadImages()); if (android.os.Build.VERSION.SDK_INT >= 21) wSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); /* * WebViewClient */ webView.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { if (!url.contains(podDomain)) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(i); return true; } return false; } public void onPageFinished(WebView view, String url) { if (url.contains("/new") || url.contains("/sign_in")) { fab.setVisibility(View.GONE); } else { fab.setVisibility(View.VISIBLE); } } public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { new AlertDialog.Builder(MainActivity.this).setIcon(android.R.drawable.ic_dialog_alert) .setMessage(description).setPositiveButton("CLOSE", null).show(); } }); /* * WebChromeClient */ webView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView wv, int progress) { progressBar.setProgress(progress); if (progress > 0 && progress <= 60) { Helpers.getNotificationCount(wv); } if (progress > 60) { Helpers.hideTopBar(wv); fab.setVisibility(View.VISIBLE); } if (progress == 100) { fab.collapse(); progressBar.setVisibility(View.GONE); } else { progressBar.setVisibility(View.VISIBLE); } } @Override public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) { if (mFilePathCallback != null) mFilePathCallback.onReceiveValue(null); mFilePathCallback = filePathCallback; Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { // Create the File where the photo should go File photoFile = null; try { photoFile = createImageFile(); takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); } catch (IOException ex) { // Error occurred while creating the File Snackbar.make(getWindow().findViewById(R.id.drawer), "Unable to get image", Snackbar.LENGTH_SHORT).show(); } // Continue only if the File was successfully created if (photoFile != null) { mCameraPhotoPath = "file:" + photoFile.getAbsolutePath(); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); } else { takePictureIntent = null; } } Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT); contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE); contentSelectionIntent.setType("image/*"); Intent[] intentArray; if (takePictureIntent != null) { intentArray = new Intent[] { takePictureIntent }; } else { intentArray = new Intent[0]; } Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER); chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent); chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray); startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); return true; } public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); /* * NavigationView */ NavigationView navigationView = findViewById(R.id.navigation_view); navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { if (menuItem.isChecked()) menuItem.setChecked(false); else menuItem.setChecked(true); drawerLayout.closeDrawers(); switch (menuItem.getItemId()) { default: Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return true; case R.id.jb_stream: if (Helpers.isOnline(MainActivity.this)) { txtTitle.setText(R.string.jb_stream); webView.loadUrl("https://" + podDomain + "/stream"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_public: setTitle(R.string.jb_public); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/public"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_liked: txtTitle.setText(R.string.jb_liked); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/liked"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_commented: txtTitle.setText(R.string.jb_commented); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/commented"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_contacts: txtTitle.setText(R.string.jb_contacts); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/contacts"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_mentions: txtTitle.setText(R.string.jb_mentions); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/mentions"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_activities: txtTitle.setText(R.string.jb_activities); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/activity"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_followed_tags: txtTitle.setText(R.string.jb_followed_tags); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/followed_tags"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_manage_tags: txtTitle.setText(R.string.jb_manage_tags); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/tag_followings/manage"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_license: txtTitle.setText(R.string.jb_license); new AlertDialog.Builder(MainActivity.this).setTitle(getString(R.string.license_title)) .setMessage(getString(R.string.license_text)) .setPositiveButton(getString(R.string.license_yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/mdev88/Diaspora-Native-WebApp")); startActivity(i); dialog.cancel(); } }) .setNegativeButton(getString(R.string.license_no), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }) .show(); return true; case R.id.jb_aspects: txtTitle.setText(R.string.jb_aspects); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/aspects"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_settings: txtTitle.setText(R.string.jb_settings); if (Helpers.isOnline(MainActivity.this)) { webView.loadUrl("https://" + podDomain + "/user/edit"); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } case R.id.jb_pod: txtTitle.setText(R.string.jb_pod); if (Helpers.isOnline(MainActivity.this)) { new AlertDialog.Builder(MainActivity.this).setTitle(getString(R.string.confirmation)) .setMessage(getString(R.string.change_pod_warning)) .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @TargetApi(11) public void onClick(DialogInterface dialog, int id) { webView.clearCache(true); dialog.cancel(); Intent i = new Intent(MainActivity.this, PodsActivity.class); startActivity(i); finish(); } }).setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @TargetApi(11) public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).show(); return true; } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); return false; } } } }); /* * DrawerLayout */ drawerLayout = findViewById(R.id.drawer); ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.openDrawer, R.string.closeDrawer); drawerLayout.setDrawerListener(actionBarDrawerToggle); //calling sync state is necessary or else your hamburger icon wont show up actionBarDrawerToggle.syncState(); if (savedInstanceState == null) { if (Helpers.isOnline(MainActivity.this)) { webView.loadData("", "text/html", null); webView.loadUrl("https://" + podDomain); } else { Snackbar.make(getWindow().findViewById(R.id.drawer), R.string.no_internet, Snackbar.LENGTH_SHORT) .show(); } } }
From source file:com.farmerbb.taskbar.service.TaskbarService.java
private boolean hasLauncherIntent(String packageName) { Intent intentToResolve = new Intent(Intent.ACTION_MAIN); intentToResolve.addCategory(Intent.CATEGORY_LAUNCHER); intentToResolve.setPackage(packageName); List<ResolveInfo> ris = getPackageManager().queryIntentActivities(intentToResolve, 0); return ris != null && ris.size() > 0; }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.RomDetailActivity.java
private void onSelectedChangeImage() { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(intent, REQUEST_IMAGE); }
From source file:com.wheelphone.remotemini.WheelphoneRemoteMini.java
public void onBackPressed() { Intent setIntent = new Intent(Intent.ACTION_MAIN); setIntent.addCategory(Intent.CATEGORY_HOME); setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(setIntent);/* ww w .j a v a2s. c o m*/ }
From source file:com.MustacheMonitor.MustacheMonitor.StacheCam.java
/** * Get image from photo library.//from ww w . j a va2 s .co m * * @param quality Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality) * @param srcType The album to get image from. * @param returnType Set the type of image to return. */ // TODO: Images selected from SDCARD don't display correctly, but from CAMERA ALBUM do! public void getImage(int srcType, int returnType) { Intent intent = new Intent(); String title = GET_PICTURE; if (this.mediaType == PICTURE) { intent.setType("image/*"); } else if (this.mediaType == VIDEO) { intent.setType("video/*"); title = GET_VIDEO; } else if (this.mediaType == ALLMEDIA) { // I wanted to make the type 'image/*, video/*' but this does not work on all versions // of android so I had to go with the wildcard search. intent.setType("*/*"); title = GET_All; } intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); if (this.cordova != null) { this.cordova.startActivityForResult((Plugin) this, Intent.createChooser(intent, new String(title)), (srcType + 1) * 16 + returnType + 1); } }
From source file:com.cpic.taylor.logistics.activity.HomeActivity.java
@Override public void onBackPressed() { // // ? // long currentTime = System.currentTimeMillis(); // long dTime = currentTime - lastTime; //// w w w .j a va 2s . c om // if (dTime < 2000) { // finish(); // } else { // showShortToast("??"); // lastTime = currentTime; // } Intent intent = new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);// ? intent.addCategory(Intent.CATEGORY_HOME); this.startActivity(intent); }