List of usage examples for android.content Intent setType
public @NonNull Intent setType(@Nullable String type)
From source file:com.nexes.manager.EventHandler.java
/** * This method, handles the button presses of the top buttons found in the * Main activity.//www . j a va 2 s. c om */ @Override public void onClick(View v) { switch (v.getId()) { case R.id.back_button: if (mFileMang.getCurrentDir() != "/") { if (multi_select_flag) { mDelegate.killMultiSelect(true); Toast.makeText(mContext, "Multi-select is now off", Toast.LENGTH_SHORT).show(); } stopThumbnailThread(); updateDirectory(mFileMang.getPreviousDir()); if (mPathLabel != null) mPathLabel.setText(mFileMang.getCurrentDir()); } break; case R.id.home_button: if (multi_select_flag) { mDelegate.killMultiSelect(true); Toast.makeText(mContext, "Multi-select is now off", Toast.LENGTH_SHORT).show(); } stopThumbnailThread(); updateDirectory(mFileMang.setHomeDir("/sdcard")); if (mPathLabel != null) mPathLabel.setText(mFileMang.getCurrentDir()); break; case R.id.info_button: Intent info = new Intent(mContext, DirectoryInfo.class); info.putExtra("PATH_NAME", mFileMang.getCurrentDir()); mContext.startActivity(info); break; case R.id.help_button: Intent help = new Intent(mContext, HelpManager.class); mContext.startActivity(help); break; case R.id.manage_button: display_dialog(MANAGE_DIALOG); break; case R.id.multiselect_button: if (multi_select_flag) { mDelegate.killMultiSelect(true); } else { LinearLayout hidden_lay = (LinearLayout) ((Activity) mContext).findViewById(R.id.hidden_buttons); multi_select_flag = true; hidden_lay.setVisibility(LinearLayout.VISIBLE); } break; /* * three hidden buttons for multiselect */ case R.id.hidden_attach: /* check if user selected objects before going further */ if (mMultiSelectData == null || mMultiSelectData.isEmpty()) { mDelegate.killMultiSelect(true); break; } ArrayList<Uri> uris = new ArrayList<Uri>(); int length = mMultiSelectData.size(); Intent mail_int = new Intent(); mail_int.setAction(android.content.Intent.ACTION_SEND_MULTIPLE); mail_int.setType("application/mail"); mail_int.putExtra(Intent.EXTRA_BCC, ""); mail_int.putExtra(Intent.EXTRA_SUBJECT, " "); for (int i = 0; i < length; i++) { File file = new File(mMultiSelectData.get(i)); uris.add(Uri.fromFile(file)); } mail_int.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); mContext.startActivity(Intent.createChooser(mail_int, "Email using...")); mDelegate.killMultiSelect(true); break; case R.id.hidden_move: case R.id.hidden_copy: /* check if user selected objects before going further */ if (mMultiSelectData == null || mMultiSelectData.isEmpty()) { mDelegate.killMultiSelect(true); break; } if (v.getId() == R.id.hidden_move) delete_after_copy = true; mInfoLabel.setText("Holding " + mMultiSelectData.size() + " file(s)"); mDelegate.killMultiSelect(false); break; case R.id.hidden_delete: /* check if user selected objects before going further */ if (mMultiSelectData == null || mMultiSelectData.isEmpty()) { mDelegate.killMultiSelect(true); break; } final String[] data = new String[mMultiSelectData.size()]; int at = 0; for (String string : mMultiSelectData) data[at++] = string; AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setMessage( "Are you sure you want to delete " + data.length + " files? This cannot be " + "undone."); builder.setCancelable(false); builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new BackgroundWork(DELETE_TYPE).execute(data); mDelegate.killMultiSelect(true); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mDelegate.killMultiSelect(true); dialog.cancel(); } }); builder.create().show(); break; } }
From source file:com.remobile.camera.CameraLauncher.java
/** * Get image from photo library.//from w w w .j a v a2s. c o 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. * @param encodingType */ // TODO: Images selected from SDCARD don't display correctly, but from CAMERA ALBUM do! // TODO: Images from kitkat filechooser not going into crop function public void getImage(int srcType, int returnType, int encodingType) { Intent intent = new Intent(); String title = GET_PICTURE; croppedUri = null; if (this.mediaType == PICTURE) { intent.setType("image/*"); if (this.allowEdit) { intent.setAction(Intent.ACTION_PICK); intent.putExtra("crop", "true"); if (targetWidth > 0) { intent.putExtra("outputX", targetWidth); } if (targetHeight > 0) { intent.putExtra("outputY", targetHeight); } if (targetHeight > 0 && targetWidth > 0 && targetWidth == targetHeight) { intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); } File photo = createCaptureFile(encodingType); croppedUri = Uri.fromFile(photo); intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, croppedUri); } else { intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); } } else if (this.mediaType == VIDEO) { intent.setType("video/*"); title = GET_VIDEO; intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); } 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((CordovaPlugin) this, Intent.createChooser(intent, new String(title)), (srcType + 1) * 16 + returnType + 1); } }
From source file:com.piusvelte.taplock.client.core.TapLockSettings.java
@Override protected void onResume() { super.onResume(); Intent intent = getIntent();/*from www . j av a2 s . c o m*/ if (mInWriteMode) { if (intent != null) { String action = intent.getAction(); if (mInWriteMode && NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) && intent.hasExtra(EXTRA_DEVICE_NAME)) { Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); String name = intent.getStringExtra(EXTRA_DEVICE_NAME); if ((tag != null) && (name != null)) { // write the device and address String lang = "en"; // don't write the passphrase! byte[] textBytes = name.getBytes(); byte[] langBytes = null; int langLength = 0; try { langBytes = lang.getBytes("US-ASCII"); langLength = langBytes.length; } catch (UnsupportedEncodingException e) { Log.e(TAG, e.toString()); } int textLength = textBytes.length; byte[] payload = new byte[1 + langLength + textLength]; // set status byte (see NDEF spec for actual bits) payload[0] = (byte) langLength; // copy langbytes and textbytes into payload if (langBytes != null) { System.arraycopy(langBytes, 0, payload, 1, langLength); } System.arraycopy(textBytes, 0, payload, 1 + langLength, textLength); NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, new byte[0], payload); NdefMessage message = new NdefMessage( new NdefRecord[] { record, NdefRecord.createApplicationRecord(getPackageName()) }); // Get an instance of Ndef for the tag. Ndef ndef = Ndef.get(tag); if (ndef != null) { try { ndef.connect(); if (ndef.isWritable()) { ndef.writeNdefMessage(message); } ndef.close(); Toast.makeText(this, "tag written", Toast.LENGTH_LONG).show(); } catch (IOException e) { Log.e(TAG, e.toString()); } catch (FormatException e) { Log.e(TAG, e.toString()); } } else { NdefFormatable format = NdefFormatable.get(tag); if (format != null) { try { format.connect(); format.format(message); format.close(); Toast.makeText(getApplicationContext(), "tag written", Toast.LENGTH_LONG); } catch (IOException e) { Log.e(TAG, e.toString()); } catch (FormatException e) { Log.e(TAG, e.toString()); } } } mNfcAdapter.disableForegroundDispatch(this); } } } mInWriteMode = false; } else { SharedPreferences sp = getSharedPreferences(KEY_PREFS, MODE_PRIVATE); onSharedPreferenceChanged(sp, KEY_DEVICES); // check if configuring a widget if (intent != null) { Bundle extras = intent.getExtras(); if (extras != null) { final String[] displayNames = TapLock.getDeviceNames(mDevices); final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { mDialog = new AlertDialog.Builder(TapLockSettings.this).setTitle("Select device for widget") .setItems(displayNames, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // set the successful widget result Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); setResult(RESULT_OK, resultValue); // broadcast the new widget to update JSONObject deviceJObj = mDevices.get(which); dialog.cancel(); TapLockSettings.this.finish(); try { sendBroadcast(TapLock .getPackageIntent(TapLockSettings.this, TapLockWidget.class) .setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE) .putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId) .putExtra(EXTRA_DEVICE_NAME, deviceJObj.getString(KEY_NAME))); } catch (JSONException e) { Log.e(TAG, e.toString()); } } }).create(); mDialog.show(); } } } // start the service before binding so that the service stays around for faster future connections startService(TapLock.getPackageIntent(this, TapLockService.class)); bindService(TapLock.getPackageIntent(this, TapLockService.class), this, BIND_AUTO_CREATE); int serverVersion = sp.getInt(KEY_SERVER_VERSION, 0); if (mShowTapLockSettingsInfo && (mDevices.size() == 0)) { if (serverVersion < SERVER_VERSION) sp.edit().putInt(KEY_SERVER_VERSION, SERVER_VERSION).commit(); mShowTapLockSettingsInfo = false; Intent i = TapLock.getPackageIntent(this, TapLockInfo.class); i.putExtra(EXTRA_INFO, getString(R.string.info_taplocksettings)); startActivity(i); } else if (serverVersion < SERVER_VERSION) { // TapLockServer has been updated sp.edit().putInt(KEY_SERVER_VERSION, SERVER_VERSION).commit(); mDialog = new AlertDialog.Builder(TapLockSettings.this).setTitle(R.string.ttl_hasupdate) .setMessage(R.string.msg_hasupdate) .setNeutralButton(R.string.button_getserver, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); mDialog = new AlertDialog.Builder(TapLockSettings.this) .setTitle(R.string.msg_pickinstaller) .setItems(R.array.installer_entries, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); final String installer_file = getResources() .getStringArray(R.array.installer_values)[which]; mDialog = new AlertDialog.Builder(TapLockSettings.this) .setTitle(R.string.msg_pickdownloader) .setItems(R.array.download_entries, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); String action = getResources() .getStringArray( R.array.download_values)[which]; if (ACTION_DOWNLOAD_SDCARD.equals(action) && copyFileToSDCard(installer_file)) Toast.makeText(TapLockSettings.this, "Done!", Toast.LENGTH_SHORT) .show(); else if (ACTION_DOWNLOAD_EMAIL .equals(action) && copyFileToSDCard( installer_file)) { Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND); emailIntent.setType( "application/java-archive"); emailIntent.putExtra(Intent.EXTRA_TEXT, getString( R.string.email_instructions)); emailIntent.putExtra( Intent.EXTRA_SUBJECT, getString(R.string.app_name)); emailIntent.putExtra( Intent.EXTRA_STREAM, Uri.parse("file://" + Environment .getExternalStorageDirectory() .getPath() + "/" + installer_file)); startActivity(Intent.createChooser( emailIntent, getString( R.string.button_getserver))); } } }) .create(); mDialog.show(); } }).create(); mDialog.show(); } }).create(); mDialog.show(); } } }
From source file:com.balakrish.gpstracker.WaypointsListActivity.java
/** * Handle activity menu// w ww . j ava 2s . co m */ @Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); final long waypointId = waypointsArrayAdapter.getItem((int) info.id).getId(); Cursor tmpCursor; String sql; switch (item.getItemId()) { case 0: // update waypoint in db updateWaypoint(waypointId); return true; case 1: deleteWaypoint(waypointId); return true; case 2: // email waypoint data using default email client String elevationUnit = app.getPreferences().getString("elevation_units", "m"); String elevationUnitLocalized = Utils.getLocalizedElevationUnit(this, elevationUnit); sql = "SELECT * FROM waypoints WHERE _id=" + waypointId + ";"; tmpCursor = app.getDatabase().rawQuery(sql, null); tmpCursor.moveToFirst(); double lat1 = tmpCursor.getDouble(tmpCursor.getColumnIndex("lat")) / 1E6; double lng1 = tmpCursor.getDouble(tmpCursor.getColumnIndex("lng")) / 1E6; String messageBody = getString(R.string.title) + ": " + tmpCursor.getString(tmpCursor.getColumnIndex("title")) + "\n\n" + getString(R.string.lat) + ": " + Utils.formatLat(lat1, 0) + "\n" + getString(R.string.lng) + ": " + Utils.formatLng(lng1, 0) + "\n" + getString(R.string.elevation) + ": " + Utils.formatElevation(tmpCursor.getFloat(tmpCursor.getColumnIndex("elevation")), elevationUnit) + elevationUnitLocalized + "\n\n" + "http://maps.google.com/?ll=" + lat1 + "," + lng1 + "&z=10"; tmpCursor.close(); final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_waypoint)); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, messageBody); this.startActivity(Intent.createChooser(emailIntent, getString(R.string.sending_email))); return true; case 3: this.showOnMap(waypointId); return true; case 4: // TODO: use a thread for online sync // sync one waypoint data with remote server // create temp waypoint from current record Waypoint wp = Waypoints.get(app.getDatabase(), waypointId); try { // preparing query string for calling web service String lat = Location.convert(wp.getLocation().getLatitude(), 0); String lng = Location.convert(wp.getLocation().getLongitude(), 0); String title = URLEncoder.encode(wp.getTitle()); String userName = app.getPreferences().getString("user_name", ""); String userPassword = app.getPreferences().getString("user_password", ""); String sessionValue = userName + "@" + Utils.md5("aripuca_session" + userPassword); if (userName.equals("") || userPassword.equals("")) { Toast.makeText(WaypointsListActivity.this, R.string.username_or_password_required, Toast.LENGTH_SHORT).show(); return false; } String queryString = "?do=ajax_map_handler&aripuca_session=" + sessionValue + "&action=add_point&lat=" + lat + "&lng=" + lng + "&z=16&n=" + title + "&d=AndroidSync"; // http connection HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpGet httpGet = new HttpGet( app.getPreferences().getString("online_sync_url", "http://tracker.aripuca.com") + queryString); HttpResponse response = httpClient.execute(httpGet, localContext); ByteArrayOutputStream outstream = new ByteArrayOutputStream(); response.getEntity().writeTo(outstream); // parsing JSON return JSONObject jsonObject = new JSONObject(outstream.toString()); Toast.makeText(WaypointsListActivity.this, jsonObject.getString("message").toString(), Toast.LENGTH_SHORT).show(); } catch (ClientProtocolException e) { Toast.makeText(WaypointsListActivity.this, "ClientProtocolException: " + e.getMessage(), Toast.LENGTH_SHORT).show(); } catch (IOException e) { Toast.makeText(WaypointsListActivity.this, "IOException " + e.getMessage(), Toast.LENGTH_SHORT) .show(); } catch (JSONException e) { Toast.makeText(WaypointsListActivity.this, "JSONException " + e.getMessage(), Toast.LENGTH_SHORT) .show(); } return true; default: return super.onContextItemSelected(item); } }
From source file:com.safecell.HomeScreenActivity.java
private void dialogMessage() { Dialog dialog = new AlertDialog.Builder(HomeScreenActivity.this).setMessage("Select Profile Picture") .setPositiveButton("Photo Library", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, 1); }//from w w w. ja v a 2 s.c o m }).setNegativeButton("New Photo", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, 2); /* * Intent nintent = new Intent( * MediaStore.ACTION_IMAGE_CAPTURE); * captureimage_filename = String * .valueOf(System.currentTimeMillis()) + * ".jpg"; * * File file = new File(Environment * .getExternalStorageDirectory(), * captureimage_filename ); * captureimage_filename_absolutepath = * file.getAbsolutePath(); outputFileUri = * Uri.fromFile(file); * nintent.putExtra(MediaStore.EXTRA_OUTPUT, * outputFileUri); * startActivityForResult(nintent, 2); */ } }).create(); dialog.show(); }
From source file:es.upv.riromu.arbre.main.MainActivity.java
/******************************************/ public void pickImage(View view) { // Do something in response to button click Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, PICK_IMAGE); }
From source file:com.odoo.core.orm.OModel.java
public void exportDB() { FileChannel source;// w ww . j ava 2 s . c om FileChannel destination; String currentDBPath = getDatabaseLocalPath(); String backupDBPath = OStorageUtils.getDirectoryPath("file") + "/" + getDatabaseName(); File currentDB = new File(currentDBPath); File backupDB = new File(backupDBPath); try { source = new FileInputStream(currentDB).getChannel(); destination = new FileOutputStream(backupDB).getChannel(); destination.transferFrom(source, 0, source.size()); source.close(); destination.close(); String subject = "Database Export: " + getDatabaseName(); Uri uri = Uri.fromFile(backupDB); Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.setType("message/rfc822"); mContext.startActivity(intent); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java
private void emailLog(final CallbackContext callback, final String email) { cordova.getThreadPool().execute(new Runnable() { public void run() { String log = readLog(); if (log == null) { callback.error(500);/* w w w . j av a 2 s .c o m*/ return; } Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("message/rfc822"); mailer.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); mailer.putExtra(Intent.EXTRA_SUBJECT, "BackgroundGeolocation log"); try { JSONObject state = getState(); if (state.has("license")) { state.put("license", "<SECRET>"); } if (state.has("orderId")) { state.put("orderId", "<SECRET>"); } mailer.putExtra(Intent.EXTRA_TEXT, state.toString(4)); } catch (JSONException e) { Log.w(TAG, "- Failed to write state to email body"); e.printStackTrace(); } File file = new File(Environment.getExternalStorageDirectory(), "background-geolocation.log"); try { FileOutputStream stream = new FileOutputStream(file); try { stream.write(log.getBytes()); stream.close(); mailer.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); file.deleteOnExit(); } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { Log.i(TAG, "FileNotFound"); e.printStackTrace(); } try { cordova.getActivity() .startActivityForResult(Intent.createChooser(mailer, "Send log: " + email + "..."), 1); callback.success(); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(cordova.getActivity(), "There are no email clients installed.", Toast.LENGTH_SHORT).show(); callback.error("There are no email clients installed"); } } }); }
From source file:com.matthewmitchell.peercoin_android_wallet.ui.WalletActivity.java
public void handleExportTransactions() { // Create CSV file from transactions final File file = new File(Constants.Files.EXTERNAL_WALLET_BACKUP_DIR, Constants.Files.TX_EXPORT_NAME + "-" + getFileDate() + ".csv"); try {/*from www .ja v a 2s.co m*/ final BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.append("Date,Label,Amount (" + MonetaryFormat.CODE_PPC + "),Fee (" + MonetaryFormat.CODE_PPC + "),Address,Transaction Hash,Confirmations\n"); if (txListAdapter == null || txListAdapter.transactions.isEmpty()) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed"); return; } final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm z"); dateFormat.setTimeZone(TimeZone.getDefault()); for (Transaction tx : txListAdapter.transactions) { TransactionsListAdapter.TransactionCacheEntry txCache = txListAdapter.getTxCache(tx); String memo = tx.getMemo() == null ? "" : StringEscapeUtils.escapeCsv(tx.getMemo()); String fee = tx.getFee() == null ? "" : tx.getFee().toPlainString(); String address = txCache.address == null ? getString(R.string.export_transactions_unknown) : txCache.address.toString(); writer.append(dateFormat.format(tx.getUpdateTime()) + ","); writer.append(memo + ","); writer.append(txCache.value.toPlainString() + ","); writer.append(fee + ","); writer.append(address + ","); writer.append(tx.getHash().toString() + ","); writer.append(tx.getConfidence().getDepthInBlocks() + "\n"); } writer.flush(); writer.close(); } catch (IOException x) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed", x); return; } final DialogBuilder dialog = new DialogBuilder(this); dialog.setMessage(Html.fromHtml(getString(R.string.export_transactions_dialog_success, file))); dialog.setPositiveButton(WholeStringBuilder.bold(getString(R.string.export_keys_dialog_button_archive)), new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.export_transactions_mail_subject)); intent.putExtra(Intent.EXTRA_TEXT, makeEmailText(getString(R.string.export_transactions_mail_text))); intent.setType(Constants.MIMETYPE_TX_EXPORT); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); try { startActivity(Intent.createChooser(intent, getString(R.string.export_transactions_mail_intent_chooser))); log.info("invoked chooser for exporting transactions"); } catch (final Exception x) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed", x); } } }); dialog.setNegativeButton(R.string.button_dismiss, null); dialog.show(); }
From source file:com.flipzu.flipzu.Player.java
private void shareFlipzu() { //create the intent Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); //set the type shareIntent.setType("text/plain"); //add a subject shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Check out this cool App"); //build the body of the message to be shared String shareMessage = "Flipzu, live audio broadcast from your Android phone: https://market.android.com/details?id=" + APP_PNAME;/*from w ww . ja v a 2s. com*/ //add the message shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMessage); //start the chooser for sharing startActivity(Intent.createChooser(shareIntent, getText(R.string.share_app))); }