1. Check out our companion app, Forums for Android! Download from Google Play

Quick Question About Intents

Discussion in 'Application Development' started by Forest Marie, Sep 3, 2010.

  1. Forest Marie

    Forest Marie Member
    Thread Starter
    5

    Dec 29, 2009
    5
    0
    5
    I have the following event handling code for a button click event here:

    Code (Text):
    1.  
    2.         ibtnShare.setOnClickListener(new OnClickListener() {
    3.          public void onClick(View v){
    4.           Intent emailIntent  = new Intent(android.content.Intent.ACTION_SEND);
    5.           emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Check this out");
    6.           emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, facts[position]);
    7.           emailIntent.setType("text/plain");
    8.           startActivity(Intent.createChooser(emailIntent, "Send mail..."));
    9.          }
    10.         });
    11.  
    Whenever I click the button, it pulls up an option to send the data via text or email. How would one set this to where it only sends it via text message or via E-Mail?

    Also is there any examples out there to show how to send something real simple to your Twitter or Facebook account?

    Much thanks and kudos in advance.

    - Forest
     

    Advertisement

Share This Page

Loading...