Example usage for android.content Intent EXTRA_TEXT

List of usage examples for android.content Intent EXTRA_TEXT

Introduction

In this page you can find the example usage for android.content Intent EXTRA_TEXT.

Prototype

String EXTRA_TEXT

To view the source code for android.content Intent EXTRA_TEXT.

Click Source Link

Document

A constant CharSequence that is associated with the Intent, used with #ACTION_SEND to supply the literal data to be sent.

Usage

From source file:at.wada811.utils.IntentUtils.java

/**
 * ??Intent??/*from ww w. jav a 2  s.com*/
 *
 * @param mailto
 * @param cc
 * @param bcc
 * @param subject
 * @param body
 */
public static Intent createSendMailIntent(String[] mailto, String[] cc, String[] bcc, String subject,
        String body) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType(HTTP.PLAIN_TEXT_TYPE);
    intent.putExtra(Intent.EXTRA_EMAIL, mailto);
    intent.putExtra(Intent.EXTRA_CC, cc);
    intent.putExtra(Intent.EXTRA_BCC, bcc);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, body);
    return intent;
}

From source file:com.sonetel.plugins.sonetelcallback.CallBack.java

@Override
public void onReceive(final Context context, Intent intent) {
    if (SipManager.ACTION_GET_PHONE_HANDLERS.equals(intent.getAction())) {
        // Retrieve and cache infos from the phone app 
        if (!sPhoneAppInfoLoaded) {
            Resources r = context.getResources();
            BitmapDrawable drawable = (BitmapDrawable) r.getDrawable(R.drawable.ic_wizard_sonetel);
            sPhoneAppBmp = drawable.getBitmap();

            sPhoneAppInfoLoaded = true;//from www.  j av  a 2s .co m
        }

        Bundle results = getResultExtras(true);
        //if(pendingIntent != null) {
        //   results.putParcelable(CallHandlerPlugin.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent);
        //}
        results.putString(Intent.EXTRA_TITLE, "Call back");// context.getResources().getString(R.string.use_pstn));
        if (sPhoneAppBmp != null) {
            results.putParcelable(Intent.EXTRA_SHORTCUT_ICON, sPhoneAppBmp);
        }
        if (intent.getStringExtra(Intent.EXTRA_TEXT) == null)
            return;

        final String dialledNum = intent.getStringExtra(Intent.EXTRA_TEXT);
        final String callthrunum = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
        DBAdapter dbAdapt = new DBAdapter(context);

        // Build pending intent

        SipAccount = dbAdapt.getAccount(1);

        if (SipAccount != null) {

            //Intent i = new Intent(Intent.ACTION_CALL);
            //i.setData(Uri.fromParts("tel", callthrunum, null));
            //final PendingIntent pendingIntent  = PendingIntent.getActivity(context, 0, i,  PendingIntent.FLAG_CANCEL_CURRENT);

            NetWorkThread = new Thread() {
                public void run() {
                    SendMsgToNetWork(dialledNum, callthrunum, context, null);
                };
            };

            NetWorkThread.start();

        } else if (SipAccount.acc_id != "1")
            Toast.makeText(context, "Unable to find Sonetel account. Please sign in using your Sonetel account",
                    Toast.LENGTH_LONG).show();

        if (!dialledNum.equalsIgnoreCase("")) {
            SipCallSessionImpl callInfo = new SipCallSessionImpl();

            callInfo.setRemoteContact(dialledNum);
            callInfo.setIncoming(false);
            callInfo.callStart = System.currentTimeMillis();
            callInfo.setAccId(4);
            //callInfo.setLastStatusCode(pjsua.PJ_SUCCESS);

            ContentValues cv = CallLogHelper.logValuesForCall(context, callInfo, callInfo.callStart);
            context.getContentResolver().insert(SipManager.CALLLOG_URI, cv);

        }
        //}
        //else
        //{

        //}
    }

    // This will exclude next time tel:xxx is raised from csipsimple treatment which is wanted
    //results.putString(Intent.EXTRA_PHONE_NUMBER, callthrunum);

}

From source file:com.example.joseba.sunshine.app.ForecastFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Now that we have some dummy forecast data, create an ArrayAdapter.
    // The ArrayAdapter will take data from a source (like our dummy forecast) and
    // use it to populate the ListView it's attached to.
    forecastAdapter = 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(forecastAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override/*from   w w w.j  a va2 s.c  o m*/
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String forecast = forecastAdapter.getItem(position);
            Intent intent = new Intent(getActivity(), DetailActivity.class).putExtra(Intent.EXTRA_TEXT,
                    forecast);

            startActivity(intent);

        }
    });
    return rootView;
}

From source file:barqsoft.footballscores.Fragments.DetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Intent intent = getActivity().getIntent();

    if (intent != null && intent.hasExtra(Intent.EXTRA_TEXT)) {
        mMatch_Id = intent.getStringExtra(Intent.EXTRA_TEXT);
        setFragmentDate(mMatch_Id);// w w  w  .ja  v  a 2 s  .c  om
    }

    View rootView = inflater.inflate(R.layout.fragment_detail_start, container, false);

    // Details score list item
    homeName = (TextView) rootView.findViewById(R.id.home_name);
    awayName = (TextView) rootView.findViewById(R.id.away_name);
    homeCrest = (ImageView) rootView.findViewById(R.id.home_crest);
    awayCrest = (ImageView) rootView.findViewById(R.id.away_crest);
    scoreText = (TextView) rootView.findViewById(R.id.score_textview);
    dataDateTextview = (TextView) rootView.findViewById(R.id.data_date_textview);
    leagueTextview = (TextView) rootView.findViewById(R.id.league_textview);
    matchdayTextview = (TextView) rootView.findViewById(R.id.matchday_textview);
    // Share button
    mShareButton = (Button) rootView.findViewById(R.id.share_button);
    mShareButton.setVisibility(View.VISIBLE);

    rootView.findViewById(R.id.scores_list_card).setFocusable(false);

    // Details additional pane
    totalMatches_count = (TextView) rootView.findViewById(R.id.detail_total_matches_count_textview);
    homeTeam_name_add_pane = (TextView) rootView.findViewById(R.id.home_name_label_textview);
    awayTeam_name_add_pane = (TextView) rootView.findViewById(R.id.away_name_label_textview);
    homeTeam_wins_add_pane = (TextView) rootView.findViewById(R.id.detail_home_wins_textview);
    awayTeam_wins_add_pane = (TextView) rootView.findViewById(R.id.detail_away_wins_textview);
    draws_count = (TextView) rootView.findViewById(R.id.detail_draw_count_textview);

    requestQueue = Volley.newRequestQueue(getActivity());

    return rootView;
}

From source file:org.quantumbadger.redreader.activities.PostSubmitActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    super.onCreate(savedInstanceState);

    final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit);

    typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type);
    usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username);
    subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit);
    titleEdit = (EditText) layout.findViewById(R.id.post_submit_title);
    textEdit = (EditText) layout.findViewById(R.id.post_submit_body);

    final Intent intent = getIntent();
    if (intent != null) {

        if (intent.hasExtra("subreddit")) {

            final String subreddit = intent.getStringExtra("subreddit");

            if (subreddit != null && subreddit.length() > 0 && !subreddit.matches("/?(r/)?all/?")
                    && subreddit.matches("/?(r/)?\\w+/?")) {
                subredditEdit.setText(subreddit);
            }/*  w  w  w. j  av  a 2  s  . c o m*/

        } else if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SEND)
                && intent.hasExtra(Intent.EXTRA_TEXT)) {
            final String url = intent.getStringExtra(Intent.EXTRA_TEXT);
            textEdit.setText(url);
        }

    } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) {
        titleEdit.setText(savedInstanceState.getString("post_title"));
        textEdit.setText(savedInstanceState.getString("post_body"));
        subredditEdit.setText(savedInstanceState.getString("subreddit"));
        typeSpinner.setSelection(savedInstanceState.getInt("post_type"));
    }

    final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts();
    final ArrayList<String> usernames = new ArrayList<String>();

    for (RedditAccount account : accounts) {
        if (!account.isAnonymous()) {
            usernames.add(account.username);
        }
    }

    if (usernames.size() == 0) {
        General.quickToast(this, R.string.error_toast_notloggedin);
        finish();
    }

    usernameSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames));
    typeSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, postTypes));

    // TODO remove the duplicate code here
    setHint();

    typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            setHint();
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    final ScrollView sv = new ScrollView(this);
    sv.addView(layout);
    setContentView(sv);
}

From source file:com.vrem.wifianalyzer.navigation.items.ExportItem.java

private Intent createIntent(String title, String data) {
    Intent intent = createSendIntent();//from   ww  w.  ja  v a  2s  .  co  m
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TITLE, title);
    intent.putExtra(Intent.EXTRA_SUBJECT, title);
    intent.putExtra(Intent.EXTRA_TEXT, data);
    return intent;
}

From source file:com.example.lidorcg.sunshine.ForecastFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final List<String> weekForecast = new ArrayList<>();

    // Now that we have some dummy forecast data, create an ArrayAdapter.
    // 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<>(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.
            weekForecast);/*from   ww w. ja  v a2 s.  c  o  m*/

    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
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(getActivity(), DetailActivity.class).putExtra(Intent.EXTRA_TEXT,
                    weekForecast.get(position));
            startActivity(intent);
        }
    });

    return rootView;
}

From source file:app.com.example.android.sunshine.ForecastFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Create some dummy data for the ListView.  Here's a sample weekly forecast
    String[] data = { "Mon 6/23- Sunny - 31/17", "Tue 6/24 - Foggy - 21/8", "Wed 6/25 - Cloudy - 22/17",
            "Thurs 6/26 - Rainy - 18/11", "Fri 6/27 - Foggy - 21/10",
            "Sat 6/28 - TRAPPED IN WEATHER STATION - 23/18", "Sun 6/29 - Sunny - 20/7" };
    List<String> weekForecast = new ArrayList<String>(Arrays.asList(data));

    // Now that we have some dummy forecast data, create an ArrayAdapter.
    // The ArrayAdapter will take data from a source (like our dummy forecast) and
    // use it to populate the ListView it's attached to.
    forecastAdapter = 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.
            weekForecast);//w  ww .  jav a 2 s  .  c  om

    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(forecastAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            Toast.makeText(getActivity(), forecastAdapter.getItem(position), Toast.LENGTH_LONG).show();
            Intent detailIntent = new Intent(getActivity(), DetailActivity.class);
            detailIntent.putExtra(Intent.EXTRA_TEXT, forecastAdapter.getItem(position));
            startActivity(detailIntent);

        }
    });
    return rootView;
}

From source file:com.android.shell.BugreportReceiver.java

/**
 * Build {@link Intent} that can be used to share the given bugreport.
 *//*w ww.  j ava2 s .  co  m*/
private static Intent buildSendIntent(Context context, Uri bugreportUri, Uri screenshotUri) {
    final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setType("application/vnd.android.bugreport");

    intent.putExtra(Intent.EXTRA_SUBJECT, bugreportUri.getLastPathSegment());
    intent.putExtra(Intent.EXTRA_TEXT, SystemProperties.get("ro.build.description"));

    final ArrayList<Uri> attachments = Lists.newArrayList(bugreportUri, screenshotUri);
    intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);

    final Account sendToAccount = findSendToAccount(context);
    if (sendToAccount != null) {
        intent.putExtra(Intent.EXTRA_EMAIL, new String[] { sendToAccount.name });
    }

    return intent;
}

From source file:com.battlelancer.seriesguide.ui.HelpActivity.java

private void sendEmail() {
    Intent intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.setType(HTTP.PLAIN_TEXT_TYPE);
    intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { SeriesGuidePreferences.SUPPORT_MAIL });
    intent.putExtra(android.content.Intent.EXTRA_SUBJECT,
            "SeriesGuide " + Utils.getVersion(this) + " Feedback");
    intent.putExtra(android.content.Intent.EXTRA_TEXT, "");

    Intent chooser = Intent.createChooser(intent, getString(R.string.feedback));
    Utils.tryStartActivity(this, chooser, true);
}