Example usage for android.content Intent EXTRA_SUBJECT

List of usage examples for android.content Intent EXTRA_SUBJECT

Introduction

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

Prototype

String EXTRA_SUBJECT

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

Click Source Link

Document

A constant string holding the desired subject line of a message.

Usage

From source file:com.pimp.companionforband.activities.main.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    sContext = getApplicationContext();//www  . j av  a 2s . c  o m
    sActivity = this;

    sharedPreferences = getApplicationContext().getSharedPreferences("MyPrefs", 0);
    editor = sharedPreferences.edit();

    bandSensorData = new BandSensorData();

    mDestinationUri = Uri.fromFile(new File(getCacheDir(), SAMPLE_CROPPED_IMAGE_NAME));

    SectionsPagerAdapter mSectionsPagerAdapter;
    ViewPager mViewPager;

    if (!checkCameraPermission(true))
        requestCameraPermission(true);
    if (!checkCameraPermission(false))
        requestCameraPermission(false);

    FiveStarsDialog fiveStarsDialog = new FiveStarsDialog(this, "pimplay69@gmail.com");
    fiveStarsDialog.setTitle(getString(R.string.rate_dialog_title))
            .setRateText(getString(R.string.rate_dialog_text)).setForceMode(false).setUpperBound(4)
            .setNegativeReviewListener(this).showAfter(5);

    AnalyticsApplication application = (AnalyticsApplication) getApplication();
    mTracker = application.getDefaultTracker();

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOffscreenPageLimit(2);
    mViewPager.setPageTransformer(true, new ZoomOutPageTransformer());
    mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            String name;
            switch (position) {
            case 0:
                name = "THEME";
                break;
            case 1:
                name = "SENSORS";
                break;
            case 2:
                name = "EXTRAS";
                break;
            default:
                name = "CfB";
            }

            mTracker.setScreenName("Image~" + name);
            mTracker.send(new HitBuilders.ScreenViewBuilder().build());

            logSwitch = (Switch) findViewById(R.id.log_switch);
            backgroundLogSwitch = (Switch) findViewById(R.id.backlog_switch);
            logStatus = (TextView) findViewById(R.id.logStatus);
            backgroundLogStatus = (TextView) findViewById(R.id.backlogStatus);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);

    Drawable headerBackground = null;
    String encoded = sharedPreferences.getString("me_tile_image", "null");
    if (!encoded.equals("null")) {
        byte[] imageAsBytes = Base64.decode(encoded.getBytes(), Base64.DEFAULT);
        headerBackground = new BitmapDrawable(
                BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length));
    }

    AccountHeader accountHeader = new AccountHeaderBuilder().withActivity(this).withCompactStyle(true)
            .withHeaderBackground((headerBackground == null) ? getResources().getDrawable(R.drawable.pipboy)
                    : headerBackground)
            .addProfiles(new ProfileDrawerItem()
                    .withName(sharedPreferences.getString("device_name", "Companion For Band"))
                    .withEmail(sharedPreferences.getString("device_mac", "pimplay69@gmail.com"))
                    .withIcon(getResources().getDrawable(R.drawable.band)))
            .build();

    result = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withActionBarDrawerToggleAnimated(true)
            .withAccountHeader(accountHeader)
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(getString(R.string.drawer_cloud))
                            .withIcon(GoogleMaterial.Icon.gmd_cloud).withIdentifier(1),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withName(getString(R.string.rate))
                            .withIcon(GoogleMaterial.Icon.gmd_rate_review).withIdentifier(2),
                    new PrimaryDrawerItem().withName(getString(R.string.feedback))
                            .withIcon(GoogleMaterial.Icon.gmd_feedback).withIdentifier(3),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withName(getString(R.string.share))
                            .withIcon(GoogleMaterial.Icon.gmd_share).withIdentifier(4),
                    new PrimaryDrawerItem().withName(getString(R.string.other))
                            .withIcon(GoogleMaterial.Icon.gmd_apps).withIdentifier(5),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withName(getString(R.string.report))
                            .withIcon(GoogleMaterial.Icon.gmd_bug_report).withIdentifier(6),
                    new PrimaryDrawerItem().withName(getString(R.string.translate))
                            .withIcon(GoogleMaterial.Icon.gmd_translate).withIdentifier(9),
                    new DividerDrawerItem(),
                    new PrimaryDrawerItem().withName(getString(R.string.support))
                            .withIcon(GoogleMaterial.Icon.gmd_attach_money).withIdentifier(7),
                    new PrimaryDrawerItem().withName(getString(R.string.aboutLib))
                            .withIcon(GoogleMaterial.Icon.gmd_info).withIdentifier(8))
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    boolean flag;
                    if (drawerItem != null) {
                        flag = true;
                        switch ((int) drawerItem.getIdentifier()) {
                        case 1:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Cloud").build());

                            if (!sharedPreferences.getString("access_token", "hi").equals("hi"))
                                startActivity(new Intent(getApplicationContext(), CloudActivity.class));
                            else
                                startActivity(new Intent(getApplicationContext(), WebviewActivity.class));
                            break;
                        case 2:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Rate and Review").build());
                            String MARKET_URL = "https://play.google.com/store/apps/details?id=";
                            String PlayStoreListing = getPackageName();
                            Intent rate = new Intent(Intent.ACTION_VIEW,
                                    Uri.parse(MARKET_URL + PlayStoreListing));
                            startActivity(rate);
                            break;
                        case 3:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Feedback").build());
                            final StringBuilder emailBuilder = new StringBuilder();
                            Intent intent = new Intent(Intent.ACTION_VIEW,
                                    Uri.parse("mailto:pimplay69@gmail.com"));
                            intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name));

                            emailBuilder.append("\n \n \nOS Version: ").append(System.getProperty("os.version"))
                                    .append("(").append(Build.VERSION.INCREMENTAL).append(")");
                            emailBuilder.append("\nOS API Level: ").append(Build.VERSION.SDK_INT);
                            emailBuilder.append("\nDevice: ").append(Build.DEVICE);
                            emailBuilder.append("\nManufacturer: ").append(Build.MANUFACTURER);
                            emailBuilder.append("\nModel (and Product): ").append(Build.MODEL).append(" (")
                                    .append(Build.PRODUCT).append(")");
                            PackageInfo appInfo = null;
                            try {
                                appInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                            } catch (PackageManager.NameNotFoundException e) {
                                e.printStackTrace();
                            }
                            assert appInfo != null;
                            emailBuilder.append("\nApp Version Name: ").append(appInfo.versionName);
                            emailBuilder.append("\nApp Version Code: ").append(appInfo.versionCode);

                            intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString());
                            startActivity(Intent.createChooser(intent, "Send via"));
                            break;
                        case 4:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Share").build());
                            Intent i = new AppInviteInvitation.IntentBuilder(
                                    getString(R.string.invitation_title))
                                            .setMessage(getString(R.string.invitation_message))
                                            .setCallToActionText(getString(R.string.invitation_cta)).build();
                            startActivityForResult(i, REQUEST_INVITE);
                            break;
                        case 5:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Other Apps").build());
                            String PlayStoreDevAccount = "https://play.google.com/store/apps/developer?id=P.I.M.P.";
                            Intent devPlay = new Intent(Intent.ACTION_VIEW, Uri.parse(PlayStoreDevAccount));
                            startActivity(devPlay);
                            break;
                        case 6:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Report Bugs").build());
                            startActivity(new Intent(MainActivity.this, GittyActivity.class));
                            break;
                        case 7:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Donate").build());

                            String base64EncodedPublicKey = getString(R.string.base64);
                            mHelper = new IabHelper(getApplicationContext(), base64EncodedPublicKey);
                            mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
                                public void onIabSetupFinished(IabResult result) {
                                    if (!result.isSuccess()) {
                                        Toast.makeText(MainActivity.this,
                                                "Problem setting up In-app Billing: " + result,
                                                Toast.LENGTH_LONG).show();
                                    }
                                }
                            });

                            final Dialog dialog = new Dialog(MainActivity.this);
                            dialog.setContentView(R.layout.dialog_donate);
                            dialog.setTitle("Donate");

                            String[] title = { "Coke", "Coffee", "Burger", "Pizza", "Meal" };
                            String[] price = { "Rs. 10.00", "Rs. 50.00", "Rs. 100.00", "Rs. 500.00",
                                    "Rs. 1,000.00" };

                            ListView listView = (ListView) dialog.findViewById(R.id.list);
                            listView.setAdapter(new DonateListAdapter(MainActivity.this, title, price));
                            listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                                @Override
                                public void onItemClick(AdapterView<?> parent, View view, int position,
                                        long id) {
                                    switch (position) {
                                    case 0:
                                        mHelper.launchPurchaseFlow(MainActivity.this, SKU_COKE, 1,
                                                mPurchaseFinishedListener, "payload");
                                        break;
                                    case 1:
                                        mHelper.launchPurchaseFlow(MainActivity.this, SKU_COFFEE, 1,
                                                mPurchaseFinishedListener, "payload");
                                        break;
                                    case 2:
                                        mHelper.launchPurchaseFlow(MainActivity.this, SKU_BURGER, 1,
                                                mPurchaseFinishedListener, "payload");
                                        break;
                                    case 3:
                                        mHelper.launchPurchaseFlow(MainActivity.this, SKU_PIZZA, 1,
                                                mPurchaseFinishedListener, "payload");
                                        break;
                                    case 4:
                                        mHelper.launchPurchaseFlow(MainActivity.this, SKU_MEAL, 1,
                                                mPurchaseFinishedListener, "payload");
                                        break;
                                    }
                                }
                            });

                            dialog.show();
                            break;
                        case 8:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("About").build());
                            new LibsBuilder().withLicenseShown(true).withVersionShown(true)
                                    .withActivityStyle(Libs.ActivityStyle.DARK).withAboutVersionShown(true)
                                    .withActivityTitle(getString(R.string.app_name)).withAboutIconShown(true)
                                    .withListener(libsListener).start(MainActivity.this);
                            break;
                        case 9:
                            mTracker.send(new HitBuilders.EventBuilder().setCategory("Action")
                                    .setAction("Translate").build());
                            Intent translate = new Intent(Intent.ACTION_VIEW,
                                    Uri.parse("https://poeditor.com/join/project/AZQxDV2440"));
                            startActivity(translate);
                            break;
                        default:
                            break;
                        }
                    } else {
                        flag = false;
                    }
                    return flag;
                }
            }).withSavedInstance(savedInstanceState).build();

    AppUpdater appUpdater = new AppUpdater(this);
    appUpdater.start();

    final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
            .allowNewDirectoryNameModification(true).newDirectoryName("CfBCamera")
            .initialDirectory(
                    sharedPreferences.getString("pic_location", "/storage/emulated/0/CompanionForBand/Camera"))
            .build();
    mDialog = DirectoryChooserFragment.newInstance(config);

    new BandUtils().execute();

    CustomActivityOnCrash.install(this);
}

From source file:com.sentaroh.android.Utilities.LogUtil.CommonLogFileListDialogFragment.java

final public void sendLogFileToDeveloper(String log_file_path) {
    CommonLogUtil.resetLogReceiver(mContext, mGp);

    String zip_file_name = mGp.getLogDirName() + "log.zip";

    File lf = new File(zip_file_name);
    lf.delete();//from   w ww .j  a va2s.c  o  m

    //      createZipFile(zip_file_name,log_file_path);
    String[] lmp = LocalMountPoint.convertFilePathToMountpointFormat(mContext, log_file_path);
    ZipUtil.createZipFile(mContext, null, null, zip_file_name, lmp[0], log_file_path);

    Intent intent = new Intent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_SEND);
    //       intent.setType("message/rfc822");  
    //       intent.setType("text/plain");
    intent.setType("application/zip");

    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "gm.developer.fhoshino@gmail.com" });
    //          intent.putExtra(Intent.EXTRA_CC, new String[]{"cc@example.com"});  
    //          intent.putExtra(Intent.EXTRA_BCC, new String[]{"bcc@example.com"});  
    intent.putExtra(Intent.EXTRA_SUBJECT, "Log file");
    intent.putExtra(Intent.EXTRA_TEXT, "Any comment");
    intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(lf));
    mContext.startActivity(intent);
}

From source file:free.yhc.netmbuddy.utils.Utils.java

public static void sendMail(Context context, String receiver, String subject, String text, File attachment) {
    if (!Utils.isNetworkAvailable())
        return;/*ww  w. ja  va  2  s. c o m*/

    Intent intent = new Intent(Intent.ACTION_SEND);
    if (null != receiver)
        intent.putExtra(Intent.EXTRA_EMAIL, new String[] { receiver });
    intent.putExtra(Intent.EXTRA_TEXT, text);
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    if (null != attachment)
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachment));
    intent.setType("message/rfc822");
    try {
        context.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        UiUtils.showTextToast(context, R.string.msg_fail_find_app);
    }
}

From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.OrgProfile.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.org_profile_export) {
        if (constituent == null) {
            Toast.makeText(getApplicationContext(), "No constituent yet!", Toast.LENGTH_SHORT).show();
            return super.onOptionsItemSelected(item);
        }/*from  w w  w  . j av a 2s  .co  m*/
        DD_SK d_SK = new DD_SK();
        d_SK.constit.add(constituent);
        constituent.loadNeighborhoods(D_Constituent.EXPAND_ALL);
        D_Neighborhood[] n = constituent.getNeighborhood();
        if (n != null) {
            for (D_Neighborhood _n : n) {
                // could also add a witness for the neighborhood (with its source... if it is me)
                d_SK.neigh.add(_n);
                //new D_Witness(a,b,c,e);
            }
        }
        //constituent.setNeighborhood(null);
        d_SK.org.add(org);
        DD_SK_Entry dsk = new DD_SK_Entry();
        dsk.key = constituent.getSK();
        dsk.name = constituent.getNameOrMy();
        dsk.creation = constituent.getCreationDate();
        dsk.type = "Profile!";
        d_SK.sk.add(dsk);

        String testText = net.ddp2p.common.config.DD.getExportTextObjectBody(d_SK);
        String testSubject = DD.getExportTextObjectTitle(this.org, constituent);
        //"DDP2P: Organization \""+ this.org.getName()+"\" Profile of \""+ constituent.getNameOrMy() + " " + Safe.SAFE_TEXT_MY_HEADER_SEP;
        /*         if (organization_gidh == null) {
                    Toast.makeText(this, "No peer. Reload!", Toast.LENGTH_SHORT).show();
                    return true;
                 }*/
        //DD_Address adr = new DD_Address();

        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_TEXT, testText);
        i.putExtra(Intent.EXTRA_SUBJECT, testSubject);
        i = Intent.createChooser(i, "send org profile Public key");
        startActivity(i);
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.sweetiepiggy.raspberrybusmalaysia.SubmitTripActivity.java

private void send_email(String msg) {
    Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { EMAIL_ADDRESS });
    intent.putExtra(Intent.EXTRA_SUBJECT, EMAIL_SUBJECT);
    intent.putExtra(Intent.EXTRA_TEXT, msg);
    intent.setType("text/plain");
    startActivity(Intent.createChooser(intent, getResources().getString(R.string.send_email)));
}

From source file:com.birdeye.MainActivity.java

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {

    switch (item.getItemId()) {
    case R.id.logout:

        fullReset();//from w  ww  .j ava  2  s.c o  m
        startActivity(LoginActivity.create(this));
        finish();

        return true;

    case R.id.About:

        final Dialog dialog2 = new Dialog(MainActivity.this);
        dialog2.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog2.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        dialog2.setContentView(R.layout.about);
        dialog2.setCancelable(false);

        dialog2.show();

        return true;

    case R.id.ShareApp:

        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/html");
        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(
                "<p>Hey, am using this really cool hashtag activated camera app. Get it here #birdeyecamera.</p>"));
        startActivity(Intent.createChooser(sharingIntent, "Share using"));

        return true;

    case R.id.Recommend:

        Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                Uri.fromParts("BirdEyeCamera", "birdeyecamera@digitalbabi.es", null));
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feature Recommendation");
        startActivity(Intent.createChooser(emailIntent, "Send email..."));

        return true;

    case R.id.rateApp:

        final Uri uri = Uri.parse("market://details?id=" + getApplicationContext().getPackageName());
        final Intent rateAppIntent = new Intent(Intent.ACTION_VIEW, uri);

        if (getPackageManager().queryIntentActivities(rateAppIntent, 0).size() > 0) {
            startActivity(rateAppIntent);
        } else {
            /* handle your error case: the device has no way to handle market urls */
        }

        return true;

    case R.id.RemoveAds:

        if (Globals.hasPaid) {
            Toast.makeText(MainActivity.this, "You already are in a premium account", Toast.LENGTH_SHORT)
                    .show();

        } else {

            removeAdsDialog();

        }

        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:nl.sogeti.android.gpstracker.actions.ShareTrack.java

private void sentGenericText(String subject, String msg) {
    final Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, msg);
    startActivity(intent);/*from  ww w. j  a  va 2 s.c o  m*/
}

From source file:de.ub0r.android.callmeter.ui.prefs.Preferences.java

/**
 * {@inheritDoc}//from www.  ja va2 s.c om
 */
@Override
public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Utils.setLocale(this);
    this.setTitle(R.string.settings);
    this.addPreferencesFromResource(R.xml.prefs);

    Preference p = this.findPreference(PREFS_ADVANCED);
    if (p != null) {
        p.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(final Preference preference, final Object newValue) {
                if (newValue.equals(true)) {
                    Preferences.this.startActivity(new Intent(Preferences.this, Help.class));
                }
                return true;
            }
        });
    }
    Market.setOnPreferenceClickListener(this, this.findPreference("more_apps"), null, "Felix+Bechstein",
            "http://code.google.com/u/felix.bechstein/");
    p = this.findPreference("send_logs");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(final Preference preference) {
                        Log.collectAndSendLog(Preferences.this);
                        return true;
                    }
                });
    }
    p = this.findPreference("send_devices");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    @Override
                    public boolean onPreferenceClick(final Preference preference) {
                        final Intent intent = new Intent(// .
                                Intent.ACTION_SEND);
                        intent.setType("text/plain");
                        intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "android+callmeter@ub0r.de", "" });
                        intent.putExtra(Intent.EXTRA_TEXT, Device.debugDeviceList());
                        intent.putExtra(Intent.EXTRA_SUBJECT, "Call Meter 3G: Device List");
                        try {
                            Preferences.this.startActivity(intent);
                        } catch (ActivityNotFoundException e) {
                            Log.e(TAG, "no mail", e);
                            Toast.makeText(Preferences.this, "no mail app found", Toast.LENGTH_LONG).show();
                        }
                        return true;
                    }
                });
    }
    p = this.findPreference("reset_data");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(final Preference preference) {
                        Preferences.this.resetDataDialog();
                        return true;
                    }
                });
    }
    p = this.findPreference("export_rules");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(final Preference preference) {
                        Preferences.this.exportData(null, DataProvider.EXPORT_RULESET_FILE);
                        return true;
                    }
                });
    }
    p = this.findPreference("export_logs");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(final Preference preference) {
                        Preferences.this.exportData(null, DataProvider.EXPORT_LOGS_FILE);
                        return true;
                    }
                });
    }
    p = this.findPreference("export_numgroups");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(final Preference preference) {
                        Preferences.this.exportData(null, DataProvider.EXPORT_NUMGROUPS_FILE);
                        return true;
                    }
                });
    }
    p = this.findPreference("export_hourgroups");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(final Preference preference) {
                        Preferences.this.exportData(null, DataProvider.EXPORT_HOURGROUPS_FILE);
                        return true;
                    }
                });
    }
    p = this.findPreference("import_rules");
    if (p != null) {
        p.setOnPreferenceClickListener(// .
                new Preference.OnPreferenceClickListener() {
                    public boolean onPreferenceClick(final Preference preference) {
                        Preferences.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(// .
                                Preferences.this.getString(// .
                                        R.string.url_rulesets))));
                        return true;
                    }
                });
    }

    this.onNewIntent(this.getIntent());
}

From source file:com.ichi2.anki.NoteEditor.java

private void fetchIntentInformation(Intent intent) {
    Bundle extras = intent.getExtras();/*from w ww .j av  a 2  s.c o m*/
    if (ACTION_CREATE_FLASHCARD.equals(intent.getAction())) {
        // mSourceLanguage = extras.getString(SOURCE_LANGUAGE);
        // mTargetLanguage = extras.getString(TARGET_LANGUAGE);
        mSourceText = new String[2];
        mSourceText[0] = extras.getString(SOURCE_TEXT);
        mSourceText[1] = extras.getString(TARGET_TEXT);
    } else {
        String first;
        String second;
        if (extras.getString(Intent.EXTRA_SUBJECT) != null) {
            first = extras.getString(Intent.EXTRA_SUBJECT);
        } else {
            first = "";
        }
        if (extras.getString(Intent.EXTRA_TEXT) != null) {
            second = extras.getString(Intent.EXTRA_TEXT);
        } else {
            second = "";
        }
        // Some users add cards via SEND intent from clipboard. In this case SUBJECT is empty
        if (first.equals("")) {
            // Assume that if only one field was sent then it should be the front
            first = second;
            second = "";
        }
        Pair<String, String> messages = new Pair<String, String>(first, second);

        mSourceText = new String[2];
        mSourceText[0] = messages.first;
        mSourceText[1] = messages.second;
    }
}

From source file:com.ivanmagda.inventory.ui.ProductEditor.java

/**
 * Helper method for placing an order with the specified supplier.
 *///  w  w  w.  j a v a 2  s  .co  m
private void placeOrder() {
    assert mProduct != null;

    if (mProduct.getReceiveQuantity() == 0) {
        Toast.makeText(this, R.string.place_order_failed_msg, Toast.LENGTH_LONG).show();
        return;
    }

    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:"));
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mProduct.getSupplier() });
    intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.place_order_subject) + mProduct.getName());
    intent.putExtra(Intent.EXTRA_TEXT, generateOrderSummary());

    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    } else {
        Toast.makeText(this, R.string.send_email_failed_msg, Toast.LENGTH_LONG).show();
    }
}