List of usage examples for android.widget EditText getText
@Override
public Editable getText()
From source file:fi.mikuz.boarder.gui.internet.Uploads.java
private HashMap<String, String> getSendList(final View layout, final InternetFullBoard board, final int phpOperation) { final EditText boardNameInput = (EditText) layout.findViewById(R.id.boardNameInput); final EditText boardVersionInput = (EditText) layout.findViewById(R.id.boardVersionInput); final EditText boardDescriptionInput = (EditText) layout.findViewById(R.id.boardDescriptionInput); final EditText boardURL0Input = (EditText) layout.findViewById(R.id.boardUrl0Input); final EditText boardURL1Input = (EditText) layout.findViewById(R.id.boardUrl1Input); final EditText boardURL2Input = (EditText) layout.findViewById(R.id.boardUrl2Input); final EditText boardURL3Input = (EditText) layout.findViewById(R.id.boardUrl3Input); final EditText boardURL4Input = (EditText) layout.findViewById(R.id.boardUrl4Input); final EditText boardScreenshotURL0Input = (EditText) layout.findViewById(R.id.boardScreenshotUrl0Input); HashMap<String, String> sendList = new HashMap<String, String>(); HashMap<String, String> urlMap = new HashMap<String, String>(); urlMap.put(InternetMenu.BOARD_URL_0_KEY, boardURL0Input.getText().toString()); urlMap.put(InternetMenu.BOARD_URL_1_KEY, boardURL1Input.getText().toString()); urlMap.put(InternetMenu.BOARD_URL_2_KEY, boardURL2Input.getText().toString()); urlMap.put(InternetMenu.BOARD_URL_3_KEY, boardURL3Input.getText().toString()); urlMap.put(InternetMenu.BOARD_URL_4_KEY, boardURL4Input.getText().toString()); for (String key : urlMap.keySet()) { String value = urlMap.get(key); sendList.put(key, value);/*from ww w. jav a 2 s .c o m*/ } if (phpOperation == InternetMenu.PHP_OPERATION_EDIT) { sendList.put(InternetMenu.BOARD_ID_KEY, Long.toString(board.getBoardId())); } sendList.put(InternetMenu.USER_ID_KEY, mUserId); sendList.put(InternetMenu.SESSION_TOKEN_KEY, mSessionToken); sendList.put(InternetMenu.BOARD_NAME_KEY, boardNameInput.getText().toString()); sendList.put(InternetMenu.BOARD_VERSION_KEY, boardVersionInput.getText().toString()); sendList.put(InternetMenu.BOARD_DESCRIPTION_KEY, boardDescriptionInput.getText().toString()); sendList.put(InternetMenu.BOARD_SCREENSHOT_0_URL_KEY, boardScreenshotURL0Input.getText().toString()); sendList.put(InternetMenu.PHP_OPERATION_KEY, Integer.toString(phpOperation)); return sendList; }
From source file:edu.cmu.hcii.hangg.beeksbeacon.Fragments.ManageBeaconFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(TAG, "bi.id: " + beaconInstance.id + ", bi.googleType: " + beaconInstance.googleType); View rootView = inflater.inflate(R.layout.fragment_manage_beacon, container, false); advertisedId_Type = (TextView) rootView.findViewById(R.id.advertisedId_Type); advertisedId_Id = (TextView) rootView.findViewById(R.id.advertisedId_Id); status = (TextView) rootView.findViewById(R.id.status); placeId = (TextView) rootView.findViewById(R.id.placeId); placeId.setOnClickListener(new View.OnClickListener() { @Override// w ww. java 2 s . c o m public void onClick(View v) { editLatLngAction(); } }); latLng = (TextView) rootView.findViewById(R.id.latLng); latLng.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editLatLngAction(); } }); mapView = (ImageView) rootView.findViewById(R.id.mapView); mapView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editLatLngAction(); } }); expectedStability = (TextView) rootView.findViewById(R.id.expectedStability); expectedStability.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle("Edit Stability"); final ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.stability_enums, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); final Spinner spinner = new Spinner(getActivity()); spinner.setAdapter(adapter); // Set the position of the spinner to the current value. if (beaconInstance.expectedStability != null && !beaconInstance.expectedStability.equals(BeaconInstance.STABILITY_UNSPECIFIED)) { for (int i = 0; i < spinner.getCount(); i++) { if (beaconInstance.expectedStability.equals(spinner.getItemAtPosition(i))) { spinner.setSelection(i); } } } builder.setView(spinner); builder.setPositiveButton("Save", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { beaconInstance.expectedStability = (String) spinner.getSelectedItem(); updateBeacon(); dialog.dismiss(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); } }); description = (TextView) rootView.findViewById(R.id.description); description.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle("Edit description"); final EditText editText = new EditText(getActivity()); editText.setText(description.getText()); builder.setView(editText); builder.setPositiveButton("Save", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { beaconInstance.description = editText.getText().toString(); updateBeacon(); dialog.dismiss(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); } }); actionButton = (Button) rootView.findViewById(R.id.actionButton); decommissionButton = (Button) rootView.findViewById(R.id.decommissionButton); decommissionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(getActivity()).setTitle("Decommission Beacon") .setMessage("Are you sure you want to decommission this beacon? This operation is " + "irreversible and the beacon cannot be registered again") .setPositiveButton("Decommission", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Callback decommissionCallback = new Callback() { @Override public void onFailure(Request request, IOException e) { logErrorAndToast("Failed request: " + request, e); } @Override public void onResponse(Response response) throws IOException { if (response.isSuccessful()) { beaconInstance.status = BeaconInstance.STATUS_DECOMMISSIONED; updateBeacon(); } else { String body = response.body().string(); logErrorAndToast("Unsuccessful decommissionBeacon request: " + body); } } }; client.decommissionBeacon(decommissionCallback, beaconInstance.getBeaconName()); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).show(); } }); attachmentsDivider = rootView.findViewById(R.id.attachmentsDivider); attachmentsLabel = (TextView) rootView.findViewById(R.id.attachmentsLabel); attachmentsTable = (TableLayout) rootView.findViewById(R.id.attachmentsTableLayout); // Fetch the namespace for the developer console project ID. We redraw the UI once that // request completes. // TODO: cache this. Callback listNamespacesCallback = new Callback() { @Override public void onFailure(Request request, IOException e) { logErrorAndToast("Failed request: " + request, e); } @Override public void onResponse(Response response) throws IOException { String body = response.body().string(); if (response.isSuccessful()) { try { JSONObject json = new JSONObject(body); JSONArray namespaces = json.getJSONArray("namespaces"); // At present there can be only one namespace. String tmp = namespaces.getJSONObject(0).getString("namespaceName"); if (tmp.startsWith("namespaces/")) { namespace = tmp.substring("namespaces/".length()); } else { namespace = tmp; } redraw(); } catch (JSONException e) { Log.e(TAG, "JSONException", e); } } else { logErrorAndToast("Unsuccessful listNamespaces request: " + body); } } }; client.listNamespaces(listNamespacesCallback); return rootView; }
From source file:cn.edu.nju.dapenti.activity.EditFeedActivity.java
public void onClickSearch(View view) { final View dialogView = getLayoutInflater().inflate(R.layout.dialog_search_feed, null); final EditText searchText = (EditText) dialogView.findViewById(R.id.searchText); final RadioGroup radioGroup = (RadioGroup) dialogView.findViewById(R.id.radioGroup); new AlertDialog.Builder(EditFeedActivity.this) // .setIcon(R.drawable.action_search) // .setTitle(R.string.feed_search) // .setView(dialogView) // .setPositiveButton(android.R.string.search_go, new DialogInterface.OnClickListener() { @Override//from www . j av a 2s . c o m public void onClick(DialogInterface dialog, int which) { if (searchText.getText().length() > 0) { String tmp = searchText.getText().toString(); try { tmp = URLEncoder.encode(searchText.getText().toString(), Constants.UTF8); } catch (UnsupportedEncodingException ignored) { } final String text = tmp; switch (radioGroup.getCheckedRadioButtonId()) { case R.id.byWebSearch: final ProgressDialog pd = new ProgressDialog(EditFeedActivity.this); pd.setMessage(getString(R.string.loading)); pd.setCancelable(true); pd.setIndeterminate(true); pd.show(); getLoaderManager().restartLoader(1, null, new LoaderCallbacks<ArrayList<HashMap<String, String>>>() { @Override public Loader<ArrayList<HashMap<String, String>>> onCreateLoader(int id, Bundle args) { return new GetFeedSearchResultsLoader(EditFeedActivity.this, text); } @Override public void onLoadFinished( Loader<ArrayList<HashMap<String, String>>> loader, final ArrayList<HashMap<String, String>> data) { pd.cancel(); if (data == null) { Toast.makeText(EditFeedActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); } else if (data.isEmpty()) { Toast.makeText(EditFeedActivity.this, R.string.no_result, Toast.LENGTH_SHORT).show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder( EditFeedActivity.this); builder.setTitle(R.string.feed_search); // create the grid item mapping String[] from = new String[] { FEED_SEARCH_TITLE, FEED_SEARCH_DESC }; int[] to = new int[] { android.R.id.text1, android.R.id.text2 }; // fill in the grid_item layout SimpleAdapter adapter = new SimpleAdapter(EditFeedActivity.this, data, R.layout.item_search_result, from, to); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mNameEditText.setText( data.get(which).get(FEED_SEARCH_TITLE)); mUrlEditText.setText( data.get(which).get(FEED_SEARCH_URL)); } }); builder.show(); } } @Override public void onLoaderReset( Loader<ArrayList<HashMap<String, String>>> loader) { } }).forceLoad(); break; case R.id.byTopic: mUrlEditText.setText("http://www.faroo.com/api?q=" + text + "&start=1&length=10&l=en&src=news&f=rss"); break; case R.id.byYoutube: mUrlEditText.setText("http://www.youtube.com/rss/user/" + text.replaceAll("\\+", "") + "/videos.rss"); break; } } } }).setNegativeButton(android.R.string.cancel, null).show(); }
From source file:co.nerdart.ourss.activity.EditFeedActivity.java
public void onClickSearch(View view) { final View dialogView = getLayoutInflater().inflate(R.layout.search_feed, null); final EditText searchText = (EditText) dialogView.findViewById(R.id.searchText); final RadioGroup radioGroup = (RadioGroup) dialogView.findViewById(R.id.radioGroup); new AlertDialog.Builder(EditFeedActivity.this) // .setIcon(R.drawable.action_search) // .setTitle(R.string.feed_search) // .setView(dialogView) // .setPositiveButton(android.R.string.search_go, new DialogInterface.OnClickListener() { @Override/* w w w . j a v a2s.co m*/ public void onClick(DialogInterface dialog, int which) { if (searchText.getText().length() > 0) { String tmp = searchText.getText().toString(); try { tmp = URLEncoder.encode(searchText.getText().toString(), Constants.UTF8); } catch (UnsupportedEncodingException ignored) { } final String text = tmp; switch (radioGroup.getCheckedRadioButtonId()) { case R.id.byWebSearch: final ProgressDialog pd = new ProgressDialog(EditFeedActivity.this); pd.setMessage(getString(R.string.loading)); pd.setCancelable(true); pd.setIndeterminate(true); pd.show(); getLoaderManager().restartLoader(1, null, new LoaderCallbacks<ArrayList<HashMap<String, String>>>() { @Override public Loader<ArrayList<HashMap<String, String>>> onCreateLoader(int id, Bundle args) { return new GetFeedSearchResultsLoader(EditFeedActivity.this, text); } @Override public void onLoadFinished( Loader<ArrayList<HashMap<String, String>>> loader, final ArrayList<HashMap<String, String>> data) { pd.cancel(); if (data == null) { Crouton.makeText(EditFeedActivity.this, R.string.error, Style.INFO); } else if (data.isEmpty()) { Crouton.makeText(EditFeedActivity.this, R.string.no_result, Style.INFO); } else { AlertDialog.Builder builder = new AlertDialog.Builder( EditFeedActivity.this); builder.setTitle(R.string.feed_search); // create the grid item mapping String[] from = new String[] { FEED_SEARCH_TITLE, FEED_SEARCH_DESC }; int[] to = new int[] { android.R.id.text1, android.R.id.text2 }; // fill in the grid_item layout SimpleAdapter adapter = new SimpleAdapter(EditFeedActivity.this, data, R.layout.search_result_item, from, to); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mNameEditText.setText( data.get(which).get(FEED_SEARCH_TITLE)); mUrlEditText.setText( data.get(which).get(FEED_SEARCH_URL)); } }); builder.show(); } } @Override public void onLoaderReset( Loader<ArrayList<HashMap<String, String>>> loader) { } }).forceLoad(); break; case R.id.byTopic: mUrlEditText.setText("http://www.faroo.com/api?q=" + text + "&start=1&length=10&l=en&src=news&f=rss"); break; case R.id.byYoutube: mUrlEditText.setText("http://www.youtube.com/rss/user/" + text.replaceAll("\\+", "") + "/videos.rss"); break; } } } }).setNegativeButton(android.R.string.cancel, null).show(); }
From source file:com.pseudosudostudios.jdd.views.Grid.java
/** * Prompts the user and calls loadGame() *//*from w ww . j a va 2 s. c o m*/ public void makeNewGame() { hasUsed = false; if (tiles != null) for (Tile[] row : tiles) for (Tile t : row) t.setVisibility(View.INVISIBLE); AlertDialog.Builder build = new AlertDialog.Builder(getContext()); build.setTitle("How many colors?").setCancelable(false); View myView = ((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)) .inflate(R.layout.number_colors_input, null); final EditText input = (EditText) myView.findViewById(R.id.colorInputET); final RadioButton easy = (RadioButton) myView.findViewById(R.id.easyRB); final RadioButton medium = (RadioButton) myView.findViewById(R.id.mediumRB); final RadioButton hard = (RadioButton) myView.findViewById(R.id.hardRB); build.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { Grid.numberOfColors = Integer.parseInt(input.getText().toString()); if (numberOfColors < 2) { numberOfColors = 2; Toast.makeText(getContext(), getContext().getString(R.string.too_few_colors), Toast.LENGTH_SHORT).show(); } if (numberOfColors > TileFactory.colors.length) numberOfColors = TileFactory.colors.length; } catch (NumberFormatException e) { Grid.numberOfColors = 6; } if (easy.isChecked()) setDifficulty(Difficulty.EASY); if (medium.isChecked()) setDifficulty(Difficulty.MEDIUM); if (hard.isChecked()) setDifficulty(Difficulty.HARD); Tile.initPaints(); loadNewGame(); invalidate(); // let it draw! } }).setView(myView).show(); }
From source file:com.mk4droid.IMC_Activities.Fragment_Comments.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { vfrag_comments = inflater.inflate(R.layout.fragment_comments, container, false); mfrag_comments = this; ctx = vfrag_comments.getContext();/*w w w .j a v a 2s. co m*/ resources = setResources(); //------------ Title --------- TextView tvTitle = (TextView) vfrag_comments.findViewById(R.id.tv_Comments_GrandTitle); tvTitle.setText(issueTitle); //------- no comments tv-------- tvNoCom = (TextView) vfrag_comments.findViewById(R.id.tvnoComments); // Comments added from a new thread so as to avoid delays TabComments = (TableLayout) vfrag_comments.findViewById(R.id.tlComments); lparams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); //-------- Enable send Comment button Button btComment = (Button) vfrag_comments.findViewById(R.id.btAddComment); // -------- Enable Commenting EditText EditText etComment = (EditText) vfrag_comments.findViewById(R.id.etComment); if (AuthFlag && InternetConnCheck.getInstance(ctx).isOnline(ctx)) { etComment.setEnabled(true); // Make icon drawable more vivid Drawable dr = resources.getDrawable(R.drawable.ic_send_holo_light); dr.setColorFilter(resources.getColor(R.color.orange), android.graphics.PorterDuff.Mode.SRC_ATOP); btComment.setCompoundDrawablesWithIntrinsicBounds(null, dr, null, null); btComment.setCompoundDrawablePadding(-40); } else { etComment.setEnabled(false); } btComment.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { //================ SEND COMMENT TO DB =============== EditText etComment = (EditText) vfrag_comments.findViewById(R.id.etComment); CommSTR = etComment.getText().toString(); if (CommSTR.length() > 0 && InternetConnCheck.getInstance(ctx).isOnline(ctx) && AuthFlag) { new AsynchTask_SendComment().execute(); } else if (!InternetConnCheck.getInstance(ctx).isOnline(ctx)) { Toast.makeText(ctx, resources.getString(R.string.NoInternet), Toast.LENGTH_SHORT).show(); } else if (!AuthFlag) { Toast.makeText(ctx, resources.getString(R.string.OnlyRegistered), Toast.LENGTH_SHORT).show(); } //=================================================== } }); return vfrag_comments; }
From source file:com.flipzu.flipzu.Player.java
private void postComment() { /* track postComment event */ tracker.trackEvent("Player", "Action", "postComment", 0); final EditText comment_et = (EditText) findViewById(R.id.post_comment_et); String comment = comment_et.getText().toString(); comment_et.setText(""); debug.logV(TAG, "postComment() " + comment); if (bcast != null) { /* hide soft keyboard */ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(comment_et.getWindowToken(), 0); AsyncFlipInterface.postComment(user, comment, Integer.parseInt(bcast.getId())); AsyncFlipInterface.getComments(Integer.parseInt(bcast.getId()), Player.this); }/*ww w .j av a 2s .c o m*/ }
From source file:arc.noaa.weather.activities.MainActivity.java
private void searchCities() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(this.getString(R.string.search_title)); final EditText input = new EditText(this); input.setInputType(InputType.TYPE_CLASS_TEXT); input.setMaxLines(1);// w w w . ja v a 2 s . co m input.setSingleLine(true); alert.setView(input, 32, 0, 32, 0); alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String result = input.getText().toString(); if (!result.isEmpty()) { saveLocation(result); } } }); alert.setNegativeButton(R.string.dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Cancelled } }); alert.show(); }
From source file:github.popeen.dsub.activity.SubsonicFragmentActivity.java
private void showLoginDialog() { final Dialog login = new Dialog(this); login.setContentView(R.layout.dialog_signin); Button btnLogin = (Button) login.findViewById(R.id.btnLogin); Button btnCancel = (Button) login.findViewById(R.id.btnCancel); btnLogin.setOnClickListener(new View.OnClickListener() { @Override//from w w w. ja va 2 s. c o m public void onClick(View view) { //Test server connection. EditText username = (EditText) login.findViewById(R.id.username); EditText password = (EditText) login.findViewById(R.id.password); EditText server = (EditText) login.findViewById(R.id.server); String strUsername = username.getText().toString(); String strPassword = password.getText().toString(); String strServer = server.getText().toString(); if (strUsername.length() > 0 && strPassword.length() > 0 && strServer.length() > 0) { Util.setRestCredentials(SubsonicFragmentActivity.this, null, strUsername, strPassword, strServer); login.dismiss(); //recreate(); SubsonicFragmentActivity.super.restart(); } } }); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { login.dismiss(); } }); login.show(); }
From source file:de.ub0r.android.callmeter.ui.prefs.Preferences.java
/** * Export data./* ww w . j a va2s. c o m*/ * * @param descr * description of the exported rule set * @param fn * one of the predefined file names from {@link DataProvider}. */ private void exportData(final String descr, final String fn) { if (descr == null) { final EditText et = new EditText(this); Builder builder = new Builder(this); builder.setView(et); builder.setCancelable(true); builder.setTitle(R.string.export_rules_descr); builder.setNegativeButton(android.R.string.cancel, null); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { Preferences.this.exportData(et.getText().toString(), fn); } }); builder.show(); } else { final ProgressDialog d = new ProgressDialog(this); d.setIndeterminate(true); d.setMessage(this.getString(R.string.export_progr)); d.setCancelable(false); d.show(); // run task in background final AsyncTask<Void, Void, String> task = // . new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(final Void... params) { if (fn.equals(DataProvider.EXPORT_RULESET_FILE)) { return DataProvider.backupRuleSet(Preferences.this, descr); } else if (fn.equals(DataProvider.EXPORT_LOGS_FILE)) { return DataProvider.backupLogs(Preferences.this, descr); } else if (fn.equals(DataProvider.EXPORT_NUMGROUPS_FILE)) { return DataProvider.backupNumGroups(Preferences.this, descr); } else if (fn.equals(DataProvider.EXPORT_HOURGROUPS_FILE)) { return DataProvider.backupHourGroups(Preferences.this, descr); } return null; } @Override protected void onPostExecute(final String result) { Log.d(TAG, "export:\n" + result); System.out.println("\n" + result); d.dismiss(); if (result != null && result.length() > 0) { Uri uri = null; int resChooser = -1; if (fn.equals(DataProvider.EXPORT_RULESET_FILE)) { uri = DataProvider.EXPORT_RULESET_URI; resChooser = R.string.export_rules_; } else if (fn.equals(DataProvider.EXPORT_LOGS_FILE)) { uri = DataProvider.EXPORT_LOGS_URI; resChooser = R.string.export_logs_; } else if (fn.equals(DataProvider.EXPORT_NUMGROUPS_FILE)) { uri = DataProvider.EXPORT_NUMGROUPS_URI; resChooser = R.string.export_numgroups_; } else if (fn.equals(DataProvider.EXPORT_HOURGROUPS_FILE)) { uri = DataProvider.EXPORT_HOURGROUPS_URI; resChooser = R.string.export_hourgroups_; } final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(DataProvider.EXPORT_MIMETYPE); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.putExtra(Intent.EXTRA_SUBJECT, // . "Call Meter 3G export"); intent.addCategory(Intent.CATEGORY_DEFAULT); try { final File d = Environment.getExternalStorageDirectory(); final File f = new File(d, DataProvider.PACKAGE + File.separator + fn); f.mkdirs(); if (f.exists()) { f.delete(); } f.createNewFile(); FileWriter fw = new FileWriter(f); fw.append(result); fw.close(); // call an exporting app with the uri to the // preferences Preferences.this.startActivity( Intent.createChooser(intent, Preferences.this.getString(resChooser))); } catch (IOException e) { Log.e(TAG, "error writing export file", e); Toast.makeText(Preferences.this, R.string.err_export_write, Toast.LENGTH_LONG) .show(); } } } }; task.execute((Void) null); } }