List of usage examples for android.content Intent ACTION_SEND
String ACTION_SEND
To view the source code for android.content Intent ACTION_SEND.
Click Source Link
From source file:gov.whitehouse.ui.fragments.app.ArticleViewerFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); ActionBar actionBar = getSherlockActivity().getSupportActionBar(); if (!((BaseActivity) getSherlockActivity()).isMultipaned()) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayUseLogoEnabled(false); }// w ww. j a v a 2 s. c om MenuItem shareItem = menu.findItem(R.id.menu_share); shareItem.setVisible(true); Intent shareIntent; try { shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, mPageInfo.getString("url")); ShareActionProvider sap = (ShareActionProvider) shareItem.getActionProvider(); sap.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); sap.setShareIntent(shareIntent); } catch (JSONException e) { e.printStackTrace(); } MenuItem favoriteItem = menu.findItem(R.id.menu_favorite); favoriteItem.setVisible(true); if (mFavorited) { favoriteItem.setTitle(R.string.unfavorite); favoriteItem.setIcon(R.drawable.ic_favorite); } else { favoriteItem.setTitle(R.string.favorite); favoriteItem.setIcon(R.drawable.ic_unfavorite); } }
From source file:com.todoroo.astrid.sync.SyncProviderPreferences.java
/** * * @param resource/* w ww .java 2s.co m*/ * if null, updates all resources */ @Override public void updatePreferences(Preference preference, Object value) { final Resources r = getResources(); // interval if (r.getString(getUtilities().getSyncIntervalKey()).equals(preference.getKey())) { int index = AndroidUtilities.indexOf(r.getStringArray(R.array.sync_SPr_interval_values), (String) value); if (index <= 0) preference.setSummary(R.string.sync_SPr_interval_desc_disabled); else preference.setSummary(r.getString(R.string.sync_SPr_interval_desc, r.getStringArray(R.array.sync_SPr_interval_entries)[index])); } // status else if (r.getString(R.string.sync_SPr_status_key).equals(preference.getKey())) { boolean loggedIn = getUtilities().isLoggedIn(); String status; //String subtitle = ""; //$NON-NLS-1$ // ! logged in - display message, click -> sync if (!loggedIn) { status = r.getString(R.string.sync_status_loggedout); statusColor = Color.rgb(19, 132, 165); } // sync is occurring else if (getUtilities().isOngoing()) { status = r.getString(R.string.sync_status_ongoing); statusColor = Color.rgb(0, 0, 100); } // last sync had errors else if (getUtilities().getLastError() != null || getUtilities().getLastAttemptedSyncDate() != 0) { // last sync was failure if (getUtilities().getLastAttemptedSyncDate() != 0) { status = r.getString(R.string.sync_status_failed, DateUtilities.getDateStringWithTime( SyncProviderPreferences.this, new Date(getUtilities().getLastAttemptedSyncDate()))); statusColor = Color.rgb(100, 0, 0); if (getUtilities().getLastSyncDate() > 0) { // subtitle = r.getString(R.string.sync_status_failed_subtitle, // DateUtilities.getDateStringWithTime(SyncProviderPreferences.this, // new Date(getUtilities().getLastSyncDate()))); } } else { long lastSyncDate = getUtilities().getLastSyncDate(); String dateString = lastSyncDate > 0 ? DateUtilities.getDateStringWithTime(SyncProviderPreferences.this, new Date(lastSyncDate)) : ""; //$NON-NLS-1$ status = r.getString(R.string.sync_status_errors, dateString); statusColor = Color.rgb(100, 100, 0); } } else if (getUtilities().getLastSyncDate() > 0) { status = r.getString(R.string.sync_status_success, DateUtilities.getDateStringWithTime( SyncProviderPreferences.this, new Date(getUtilities().getLastSyncDate()))); statusColor = Color.rgb(0, 100, 0); } else { status = r.getString(R.string.sync_status_never); statusColor = Color.rgb(0, 0, 100); } preference.setTitle(R.string.sync_SPr_sync); preference.setSummary(r.getString(R.string.sync_SPr_status_subtitle, status)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference p) { startSync(); return true; } }); View view = findViewById(R.id.status); if (view != null) view.setBackgroundColor(statusColor); } else if (r.getString(R.string.sync_SPr_key_last_error).equals(preference.getKey())) { if (getUtilities().getLastError() != null) { // Display error final String service = getTitle().toString(); final String lastErrorFull = getUtilities().getLastError(); final String lastErrorDisplay = adjustErrorForDisplay(r, lastErrorFull, service); preference.setTitle(R.string.sync_SPr_last_error); preference.setSummary(R.string.sync_SPr_last_error_subtitle); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override @SuppressWarnings("nls") public boolean onPreferenceClick(Preference pref) { // Show last error new AlertDialog.Builder(SyncProviderPreferences.this).setTitle(R.string.sync_SPr_last_error) .setMessage(lastErrorDisplay) .setPositiveButton(R.string.sync_SPr_send_report, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("plain/text") .putExtra(Intent.EXTRA_EMAIL, new String[] { "android-bugs@astrid.com" }) .putExtra(Intent.EXTRA_SUBJECT, service + " Sync Error") .putExtra(Intent.EXTRA_TEXT, lastErrorFull); startActivity(Intent.createChooser(emailIntent, r.getString(R.string.sync_SPr_send_report))); } }).setNegativeButton(R.string.DLG_close, null).create().show(); return true; } }); } else { PreferenceCategory statusCategory = (PreferenceCategory) findPreference( r.getString(R.string.sync_SPr_group_status)); statusCategory.removePreference(findPreference(r.getString(R.string.sync_SPr_key_last_error))); } } // log out button else if (r.getString(R.string.sync_SPr_forget_key).equals(preference.getKey())) { boolean loggedIn = getUtilities().isLoggedIn(); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference p) { DialogUtilities.okCancelDialog(SyncProviderPreferences.this, r.getString(R.string.sync_forget_confirm), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { logOut(); initializePreference(getPreferenceScreen()); } }, null); return true; } }); if (!loggedIn) { PreferenceCategory category = (PreferenceCategory) findPreference( r.getString(R.string.sync_SPr_key_options)); category.removePreference(preference); } } }
From source file:com.cerema.cloud2.ui.activity.ShareActivity.java
/** * Updates the view associated to the activity after the finish of some operation over files * in the current account./*from w ww. j a v a2 s. co m*/ * * @param operation Removal operation performed. * @param result Result of the removal. */ @Override public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) { super.onRemoteOperationFinish(operation, result); if (result.isSuccess() || (operation instanceof GetSharesForFileOperation && result.getCode() == RemoteOperationResult.ResultCode.SHARE_NOT_FOUND)) { Log_OC.d(TAG, "Refreshing view on successful operation or finished refresh"); refreshSharesFromStorageManager(); } if (operation instanceof CreateShareViaLinkOperation && result.isSuccess()) { // Send link to the app String link = ((OCShare) (result.getData().get(0))).getShareLink(); Log_OC.d(TAG, "Share link = " + link); Intent intentToShareLink = new Intent(Intent.ACTION_SEND); intentToShareLink.putExtra(Intent.EXTRA_TEXT, link); intentToShareLink.setType("text/plain"); String[] packagesToExclude = new String[] { getPackageName() }; DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude); chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG); } if (operation instanceof UnshareOperation && result.isSuccess() && getEditShareFragment() != null) { getSupportFragmentManager().popBackStack(); } if (operation instanceof UpdateSharePermissionsOperation && getEditShareFragment() != null && getEditShareFragment().isAdded()) { getEditShareFragment().onUpdateSharePermissionsFinished(result); } }
From source file:co.carlosjimenez.android.currencyalerts.app.DetailActivityFragment.java
private Intent createShareForecastIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, mDisplayedRate + FOREX_SHARE_HASHTAG); return shareIntent; }
From source file:com.zia.freshdocs.widget.CMISAdapter.java
/** * Send the content using a built-in Android activity which can handle the content type. * @param position/*from w w w.j av a2s . c o m*/ */ public void shareContent(int position) { final NodeRef ref = getItem(position); downloadContent(ref, new Handler() { public void handleMessage(Message msg) { Context context = getContext(); boolean done = msg.getData().getBoolean("done"); if (done) { dismissProgressDlg(); File file = (File) _dlThread.getResult(); if (file != null) { Resources res = context.getResources(); Uri uri = Uri.fromFile(file); Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_STREAM, uri); emailIntent.putExtra(Intent.EXTRA_SUBJECT, ref.getName()); emailIntent.putExtra(Intent.EXTRA_TEXT, res.getString(R.string.email_text)); emailIntent.setType(ref.getContentType()); try { context.startActivity( Intent.createChooser(emailIntent, res.getString(R.string.email_title))); } catch (ActivityNotFoundException e) { String text = "No suitable applications registered to send " + ref.getContentType(); int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } } else { int value = msg.getData().getInt("progress"); if (value > 0) { _progressDlg.setProgress(value); } } } }); }
From source file:org.jnegre.android.osmonthego.service.ExportService.java
/** * Handle export in the provided background thread *///from w w w .j a v a 2 s . co m private void handleOsmExport(boolean includeAddress, boolean includeFixme) { //TODO handle empty survey //TODO handle bounds around +/-180 if (!isExternalStorageWritable()) { notifyUserOfError(); return; } int id = 0; double minLat = 200; double minLng = 200; double maxLat = -200; double maxLng = -200; StringBuilder builder = new StringBuilder(); if (includeAddress) { Uri uri = AddressTableMetaData.CONTENT_URI; Cursor cursor = getContentResolver().query(uri, new String[] { //projection AddressTableMetaData.LATITUDE, AddressTableMetaData.LONGITUDE, AddressTableMetaData.NUMBER, AddressTableMetaData.STREET }, null, //selection string null, //selection args array of strings null); //sort order if (cursor == null) { notifyUserOfError(); return; } try { int iLat = cursor.getColumnIndex(AddressTableMetaData.LATITUDE); int iLong = cursor.getColumnIndex(AddressTableMetaData.LONGITUDE); int iNumber = cursor.getColumnIndex(AddressTableMetaData.NUMBER); int iStreet = cursor.getColumnIndex(AddressTableMetaData.STREET); for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { //Gather values double lat = cursor.getDouble(iLat); double lng = cursor.getDouble(iLong); String number = cursor.getString(iNumber); String street = cursor.getString(iStreet); minLat = Math.min(minLat, lat); maxLat = Math.max(maxLat, lat); minLng = Math.min(minLng, lng); maxLng = Math.max(maxLng, lng); builder.append("<node id=\"-").append(++id).append("\" lat=\"").append(lat).append("\" lon=\"") .append(lng).append("\" version=\"1\" action=\"modify\">\n"); addOsmTag(builder, "addr:housenumber", number); addOsmTag(builder, "addr:street", street); builder.append("</node>\n"); } } finally { cursor.close(); } } if (includeFixme) { Uri uri = FixmeTableMetaData.CONTENT_URI; Cursor cursor = getContentResolver().query(uri, new String[] { //projection FixmeTableMetaData.LATITUDE, FixmeTableMetaData.LONGITUDE, FixmeTableMetaData.COMMENT }, null, //selection string null, //selection args array of strings null); //sort order if (cursor == null) { notifyUserOfError(); return; } try { int iLat = cursor.getColumnIndex(FixmeTableMetaData.LATITUDE); int iLong = cursor.getColumnIndex(FixmeTableMetaData.LONGITUDE); int iComment = cursor.getColumnIndex(FixmeTableMetaData.COMMENT); for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { //Gather values double lat = cursor.getDouble(iLat); double lng = cursor.getDouble(iLong); String comment = cursor.getString(iComment); minLat = Math.min(minLat, lat); maxLat = Math.max(maxLat, lat); minLng = Math.min(minLng, lng); maxLng = Math.max(maxLng, lng); builder.append("<node id=\"-").append(++id).append("\" lat=\"").append(lat).append("\" lon=\"") .append(lng).append("\" version=\"1\" action=\"modify\">\n"); addOsmTag(builder, "fixme", comment); builder.append("</node>\n"); } } finally { cursor.close(); } } try { File destinationFile = getDestinationFile(); destinationFile.getParentFile().mkdirs(); PrintWriter writer = new PrintWriter(destinationFile, "UTF-8"); writer.println("<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>"); writer.println("<osm version=\"0.6\" generator=\"OsmOnTheGo\">"); writer.print("<bounds minlat=\""); writer.print(minLat - MARGIN); writer.print("\" minlon=\""); writer.print(minLng - MARGIN); writer.print("\" maxlat=\""); writer.print(maxLat + MARGIN); writer.print("\" maxlon=\""); writer.print(maxLng + MARGIN); writer.println("\" />"); writer.println(builder); writer.print("</osm>"); writer.close(); if (writer.checkError()) { notifyUserOfError(); } else { //FIXME i18n the subject and content Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); emailIntent.setType(HTTP.OCTET_STREAM_TYPE); //emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"johndoe@exemple.com"}); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "OSM On The Go"); emailIntent.putExtra(Intent.EXTRA_TEXT, "Your last survey."); emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(destinationFile)); startActivity(emailIntent); } } catch (IOException e) { Log.e(TAG, "Could not write to file", e); notifyUserOfError(); } }
From source file:com.codeskraps.sbrowser.home.SBrowserActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.itemQuit) { try {/*from w ww . j a v a2s. c o m*/ dataBaseData.deleteTable(DataBaseData.DB_TABLE_TABS); } catch (Exception e) { Log.e(TAG, "deleteTable: " + e.getMessage()); } this.finish(); overridePendingTransition(R.anim.fadein, R.anim.fadeout); } else if (item.getItemId() == R.id.itemFeedback) { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); String aEmailList[] = { "codeskraps@gmail.com" }; emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "sBrowser - Feedback"); emailIntent.setType("plain/text"); startActivity(Intent.createChooser(emailIntent, "Send your feedback in:")); /*- } else if (item.getItemId() == R.id.itemBuyMeAPint) { try { Intent marketIntent = new Intent(Intent.ACTION_VIEW); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(marketIntent.setData(Uri.parse("market://developer?id=Codeskraps"))); } catch (Exception e) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/developer?id=Codeskraps")); browserIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(browserIntent); Log.e(TAG, e.getMessage()); } */ } else { try { Picture picture = webView.capturePicture(); PictureDrawable pictureDrawable = new PictureDrawable(picture); Bitmap bitmap = Bitmap.createBitmap(300, 300, Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); canvas.drawPicture(pictureDrawable.getPicture()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(android.graphics.Bitmap.CompressFormat.PNG, 100, (OutputStream) bos); bitmap.isRecycled(); BookmarkItem bookmarkItem = new BookmarkItem(webView.getTitle(), webView.getUrl()); bookmarkItem.setImage(bos.toByteArray()); sBrowserData.setBookmarkItem(bookmarkItem); bos.close(); } catch (Exception e) { Log.e(TAG, "Picture:" + e.getMessage()); BookmarkItem bookmarkItem = new BookmarkItem("Set title", "Set url"); bookmarkItem.setImage(null); sBrowserData.setBookmarkItem(bookmarkItem); } SBrowserApplication sBrwoserApp = (SBrowserApplication) getApplication(); SBrowserActivity.this.startActivity(sBrwoserApp.getMenuIntent(item, SBrowserActivity.this)); overridePendingTransition(R.anim.fadein, R.anim.fadeout); } return super.onOptionsItemSelected(item); }
From source file:bander.notepad.NoteListAppCompat.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info; try {/* ww w. j av a 2s . c o m*/ info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); } catch (ClassCastException e) { return false; } switch (item.getItemId()) { case DELETE_ID: deleteNote(this, info.id); return true; case SEND_ID: Uri uri = ContentUris.withAppendedId(Note.CONTENT_URI, info.id); Cursor cursor = getContentResolver().query(uri, new String[] { Note._ID, Note.TITLE, Note.BODY }, null, null, null); Note note = Note.fromCursor(cursor); cursor.close(); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, note.getBody()); startActivity(Intent.createChooser(intent, getString(R.string.menu_send))); return true; } return false; }
From source file:com.altcanvas.twitspeak.TwitSpeakActivity.java
public boolean checkStackTrace() { FileInputStream traceIn = null; try {/*from ww w . j a v a 2s . co m*/ traceIn = openFileInput("stack.trace"); traceIn.close(); } catch (FileNotFoundException fnfe) { // No stack trace available return false; } catch (IOException ioe) { return false; } AlertDialog alert = new AlertDialog.Builder(this).create(); alert.setMessage(getResources().getString(R.string.crashreport_msg)); alert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.emailstr), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String trace = ""; String line = null; try { BufferedReader reader = new BufferedReader( new InputStreamReader(TwitSpeakActivity.this.openFileInput("stack.trace"))); while ((line = reader.readLine()) != null) { trace += line + "\n"; } } catch (FileNotFoundException fnfe) { Log.logException(TAG, fnfe); } catch (IOException ioe) { Log.logException(TAG, ioe); } Intent sendIntent = new Intent(Intent.ACTION_SEND); String subject = "Error report"; String body = getResources().getString(R.string.mailthisto_msg) + " jayesh@altcanvas.com: " + "\n\n" + G.getPhoneInfo() + "\n\n" + "TwitSpeak [" + G.VERSION_STRING + "]" + "\n\n" + trace + "\n\n"; sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "jayesh@altcanvas.com" }); sendIntent.putExtra(Intent.EXTRA_TEXT, body); sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject); sendIntent.setType("message/rfc822"); TwitSpeakActivity.this.startActivityForResult( Intent.createChooser(sendIntent, getResources().getString(R.string.emailstr)), G.REQCODE_EMAIL_STACK_TRACE); TwitSpeakActivity.this.deleteFile("stack.trace"); } }); alert.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancelstr), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { TwitSpeakActivity.this.deleteFile("stack.trace"); TwitSpeakActivity.this.continueOnCreate(); } }); alert.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { TwitSpeakActivity.this.deleteFile("stack.trace"); TwitSpeakActivity.this.continueOnCreate(); } }); alert.show(); return true; }
From source file:at.alladin.rmbt.android.about.RMBTAboutFragment.java
private View createView(View view, LayoutInflater inflater) { activity = getActivity();//from ww w . j av a2 s . c o m getAppInfo(activity); final String clientUUID = String.format("U%s", ConfigHelper.getUUID(activity.getApplicationContext())); final String controlServerVersion = ConfigHelper.getControlServerVersion(activity); final ListView listView = (ListView) view.findViewById(R.id.aboutList); final ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); HashMap<String, String> item; item = new HashMap<String, String>(); item.put("title", clientName); item.put("text1", this.getString(R.string.about_rtr_line1)); list.add(item); item = new HashMap<String, String>(); item.put("title", this.getString(R.string.about_version_title)); item.put("text1", clientVersion); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_clientid_title)); item.put("text1", clientUUID); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_web_title)); item.put("text1", getString(R.string.about_web_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_email_title)); item.put("text1", getString(R.string.about_email_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_terms_title)); item.put("text1", getString(R.string.about_terms_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_git_title)); item.put("text1", getString(R.string.about_git_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_dev_title)); item.put("text1", getString(R.string.about_dev_line1)); item.put("text2", getString(R.string.about_dev_line2)); list.add(item); final String openSourceSoftwareLicenseInfo = GooglePlayServicesUtil .getOpenSourceSoftwareLicenseInfo(getActivity()); if (openSourceSoftwareLicenseInfo != null) { item = new HashMap<String, String>(); item.put("title", getString(R.string.about_gms_legal_title)); item.put("text1", getString(R.string.about_gms_legal_line1)); item.put("text2", ""); list.add(item); } if (ConfigHelper.isDevEnabled(getActivity())) { item = new HashMap<String, String>(); item.put("title", getString(R.string.about_test_counter_title)); item.put("text1", Integer.toString(ConfigHelper.getTestCounter(getActivity()))); item.put("text2", ""); list.add(item); } item = new HashMap<String, String>(); item.put("title", getString(R.string.about_control_server_version)); item.put("text1", controlServerVersion != null ? controlServerVersion : "---"); item.put("text2", ""); list.add(item); sa = new RMBTAboutAdapter(getActivity(), list, R.layout.about_item, new String[] { "title", "text1", "text2" }, new int[] { R.id.title, R.id.text1, R.id.text2 }); listView.setAdapter(sa); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(final AdapterView<?> l, final View v, final int position, final long id) { switch (position) { case 1: handleHiddenCode(); break; case 2: final android.content.ClipboardManager clipBoard = (android.content.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("client_uuid", clientUUID); clipBoard.setPrimaryClip(clip); final Toast toast = Toast.makeText(getActivity(), R.string.about_clientid_toast, Toast.LENGTH_LONG); toast.show(); break; case 3: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_web_link)))); break; case 4: /* Create the Intent */ final Intent emailIntent = new Intent(Intent.ACTION_SEND); /* Fill it with Data */ emailIntent.setType("plain/text"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.about_email_email) }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.about_email_subject)); emailIntent.putExtra(Intent.EXTRA_TEXT, ""); /* Send it off to the Activity-Chooser */ startActivity(Intent.createChooser(emailIntent, getString(R.string.about_email_sending))); break; case 5: final FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft; ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, new RMBTTermsFragment(), "terms"); ft.addToBackStack("terms"); ft.commit(); break; case 6: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_git_link)))); break; case 7: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_dev_link)))); break; case 8: final String licenseInfo = GooglePlayServicesUtil .getOpenSourceSoftwareLicenseInfo(getActivity()); AlertDialog.Builder licenseDialog = new AlertDialog.Builder(getActivity()); licenseDialog.setMessage(licenseInfo); licenseDialog.show(); break; default: break; } } }); return view; }