List of usage examples for android.content Intent EXTRA_TEXT
String EXTRA_TEXT
To view the source code for android.content Intent EXTRA_TEXT.
Click Source Link
From source file:com.example.android.sunshine2.app.ForecastFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The ArrayAdapter will take data from a source and // use it to populate the ListView it's attached to. mForecastAdapter = new ArrayAdapter<String>(getActivity(), // The current context (this activity) R.layout.list_item_forecast, // The name of the layout ID. R.id.list_item_forecast_TextView, // The ID of the textview to populate. new ArrayList<String>()); View rootView = inflater.inflate(R.layout.fragment_main, container, false); // Get a reference to the ListView, and attach this adapter to it. ListView listView = (ListView) rootView.findViewById(R.id.ListView_forecast); listView.setAdapter(mForecastAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override// ww w .j av a2 s . com public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { String forecast = mForecastAdapter.getItem(position); Intent intent = new Intent(getActivity(), DetailActivity.class).putExtra(Intent.EXTRA_TEXT, forecast); startActivity(intent); } }); return rootView; }
From source file:com.example.evilkhaoskat.sunshine.app.ForecastFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The ArrayAdapter will take data from a source and // use it to populate the ListView it's attached to. mForecastAdapter = new ArrayAdapter<String>(getActivity(), // The current context (this activity) R.layout.list_item_forecast, // The name of the layout ID. R.id.list_item_forecast_textview, // The ID of the textview to populate. new ArrayList<String>()); View rootView = inflater.inflate(R.layout.fragment_main, container, false); // Get a reference to the ListView, and attach this adapter to it. ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast); listView.setAdapter(mForecastAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from www. ja v a 2 s.c om*/ public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { String forecast = mForecastAdapter.getItem(position); Intent intent = new Intent(getActivity(), DetailActivity.class).putExtra(Intent.EXTRA_TEXT, forecast); startActivity(intent); } }); return rootView; }
From source file:ca.rmen.android.networkmonitor.app.about.AboutActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_send_logs: new AsyncTask<Void, Void, Boolean>() { @Override//from w ww . j a v a 2 s. c o m protected Boolean doInBackground(Void... params) { if (!Log.prepareLogFile()) { return false; } // Bring up the chooser to share the file. Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); //sendIntent.setData(Uri.fromParts("mailto", getString(R.string.send_logs_to), null)); sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.support_send_debug_logs_subject)); String messageBody = getString(R.string.support_send_debug_logs_body); File f = new File(getExternalFilesDir(null), Log.FILE); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + f.getAbsolutePath())); sendIntent.setType("message/rfc822"); sendIntent.putExtra(Intent.EXTRA_TEXT, messageBody); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.support_send_debug_logs_to) }); startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.action_share))); return true; } @Override protected void onPostExecute(Boolean result) { if (!result) Toast.makeText(AboutActivity.this, R.string.support_error, Toast.LENGTH_LONG).show(); } }.execute(); return true; } return super.onOptionsItemSelected(item); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEvent.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { finish();/*from w w w . j a v a2 s . co m*/ return true; } case R.id.AddLog: { addMessageDialog = new Dialog(ViewZenossEvent.this); addMessageDialog.setContentView(R.layout.add_message); addMessageDialog.setTitle("Add Message to Event Log"); ((Button) addMessageDialog.findViewById(R.id.SaveButton)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AddLogMessage(((EditText) addMessageDialog.findViewById(R.id.LogMessage)).getText().toString()); addMessageDialog.dismiss(); } }); addMessageDialog.show(); return true; } case R.id.escalate: { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, "Escalation of Zenoss Event on " + getIntent().getStringExtra("Device")); String EventDetails = getIntent().getStringExtra("Summary") + "\r\r\n" + getIntent().getStringExtra("LastTime") + "\r\r\n" + "Count: " + getIntent().getIntExtra("Count", 0); intent.putExtra(Intent.EXTRA_TEXT, EventDetails); startActivity(Intent.createChooser(intent, "How would you like to escalate this event?")); } default: { return false; } } }
From source file:net.reichholf.dreamdroid.activities.DreamDroidShareActivity.java
@SuppressWarnings("deprecation") private void playOnDream(Profile p) { String url = null;// ww w. j ava 2s . c om Intent i = getIntent(); Bundle extras = i.getExtras(); mShc = SimpleHttpClient.getInstance(p); if (Intent.ACTION_SEND.equals(i.getAction())) url = extras.getString(Intent.EXTRA_TEXT); else if (Intent.ACTION_VIEW.equals(i.getAction())) url = i.getDataString(); if (url != null) { Log.i(LOG_TAG, url); Log.i(LOG_TAG, p.getHost()); String time = DateFormat.getDateFormat(this).format(new Date()); String title = getString(R.string.sent_from_dreamdroid, time); if (extras != null) { // semperVidLinks sends "artist" and "song" attributes for the // youtube video titles String song = extras.getString("song"); if (song != null) { String artist = extras.getString("artist"); if (artist != null) title = artist + " - " + song; } else { String tmp = extras.getString("title"); if (tmp != null) title = tmp; } } mTitle = new String(title); url = URLEncoder.encode(url).replace("+", "%20"); title = URLEncoder.encode(title).replace("+", "%20"); String ref = "4097:0:1:0:0:0:0:0:0:0:" + url + ":" + title; Log.i(LOG_TAG, ref); ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("file", ref)); execSimpleResultTask(params); } else { finish(); } }
From source file:com.banana.instagrab.helper.NotificationUtils.java
private static PendingIntent contentIntent(Context context) { // String path = "abc"; //folder name // String fileName = "1234.jpg"; // String directoryPath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM; // File dirFile = new File(directoryPath + File.separator + path); // if (!dirFile.exists()) { // Log.d("JSONTEST", "dirFile.mkdir() result : " + dirFile.mkdir()); // }//w w w.java 2s. com // File toBeSavedFile = new File(dirFile.getPath() + File.separator + fileName); // Intent intent = new Intent(); // intent.setAction(Intent.ACTION_VIEW); // intent.setDataAndType(Uri.parse(toBeSavedFile.toString()), "image/*"); Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "Awesome message"); sendIntent.setType("text/plain"); return PendingIntent.getService(context, WATER_REMINDER_PENDING_INTENT_ID, sendIntent, PendingIntent.FLAG_UPDATE_CURRENT); // return PendingIntent.getActivity( // context, // WATER_REMINDER_PENDING_INTENT_ID, // intent, // PendingIntent.FLAG_UPDATE_CURRENT); }
From source file:net.reichholf.dreamdroid.activities.ShareActivity.java
@SuppressWarnings("deprecation") private void playOnDream(Profile p) { String url = null;//from w ww .j av a 2 s .c o m Intent i = getIntent(); Bundle extras = i.getExtras(); mShc = SimpleHttpClient.getInstance(p); if (Intent.ACTION_SEND.equals(i.getAction())) url = extras.getString(Intent.EXTRA_TEXT); else if (Intent.ACTION_VIEW.equals(i.getAction())) url = i.getDataString(); if (url != null) { Log.i(LOG_TAG, url); Log.i(LOG_TAG, p.getHost()); String time = DateFormat.getDateFormat(this).format(new Date()); String title = getString(R.string.sent_from_dreamdroid, time); if (extras != null) { // semperVidLinks sends "artist" and "song" attributes for the // youtube video titles String song = extras.getString("song"); if (song != null) { String artist = extras.getString("artist"); if (artist != null) title = artist + " - " + song; } else { String tmp = extras.getString("title"); if (tmp != null) title = tmp; } } mTitle = title; url = URLEncoder.encode(url).replace("+", "%20"); title = URLEncoder.encode(title).replace("+", "%20"); String ref = "4097:0:1:0:0:0:0:0:0:0:" + url + ":" + title; Log.i(LOG_TAG, ref); ArrayList<NameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("file", ref)); execSimpleResultTask(params); } else { finish(); } }
From source file:com.orca19.android.weather.ForecastFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The ArrayAdapter will take data from a source (like our dummy forecast) and // use it to populate the ListView it's attached to. mForecastAdapter = new ArrayAdapter<String>(getActivity(), // The current context (this activity) R.layout.list_item_forecast, // The name of the layout ID. R.id.list_item_forecast_textview, // The ID of the textview to populate. new ArrayList<String>()); View rootView = inflater.inflate(R.layout.fragment_main, container, false); // Get a reference to the ListView, and attach this adapter to it. ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast); listView.setAdapter(mForecastAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//from ww w .j a v a2s .c o m public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { String forecast = mForecastAdapter.getItem(position); Intent detailIntent = new Intent(getActivity(), DetailActivity.class).putExtra(Intent.EXTRA_TEXT, forecast); startActivity(detailIntent); // Toast.makeText(getActivity(), forecast, Toast.LENGTH_SHORT).show(); } }); return rootView; }
From source file:com.example_pfe.android.sunshine.ForecastFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The ArrayAdapter will take data from a source and // use it to populate the ListView it's attached to. mForecastAdapter = new ArrayAdapter<String>(getActivity(), // The current context (this activity) R.layout.list_item_forecast, // The name of the layout ID. R.id.list_item_forecast_textview, // The ID of the textview to populate. new ArrayList<String>()); View rootView = inflater.inflate(R.layout.fragment_main, container, false); // Get a reference to the ListView, and attach this adapter to it. ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast); listView.setAdapter(mForecastAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*www.j a va 2s . c o m*/ public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { String forecast = mForecastAdapter.getItem(position); Intent intent = new Intent(getActivity(), com.example_pfe.android.sunshine.DetailActivity.class) .putExtra(Intent.EXTRA_TEXT, forecast); startActivity(intent); } }); return rootView; }