當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.ACTION_SEND屬性代碼示例

本文整理匯總了Java中android.content.Intent.ACTION_SEND屬性的典型用法代碼示例。如果您正苦於以下問題:Java Intent.ACTION_SEND屬性的具體用法?Java Intent.ACTION_SEND怎麽用?Java Intent.ACTION_SEND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.content.Intent的用法示例。


在下文中一共展示了Intent.ACTION_SEND屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SendPresenter

SendPresenter(@NonNull SendContract.View view,
              @NonNull BaseSchedulerProvider schedulerProvider,
              @NonNull ActionConfig actionConfig,
              @NonNull ResolveInfosRepository resolveInfosRepository) {
    super(view, schedulerProvider, actionConfig, resolveInfosRepository);

    if (!Intent.ACTION_SEND.equals(actionConfig.actionName)) {
        throw new IllegalArgumentException(actionConfig.actionName +
                " is not " + Intent.ACTION_SEND);
    }
    if (actionConfig.text == null) {
        throw new NullPointerException("actionConfig.text == null");
    }
    if (!MimeType.TEXT_PLAIN.equals(actionConfig.mimeType)) {
        throw new IllegalArgumentException(actionConfig.mimeType + " is not " +
                MimeType.TEXT_PLAIN);
    }
}
 
開發者ID:JulianAndroid,項目名稱:AppChooser,代碼行數:18,代碼來源:SendPresenter.java

示例2: onClick

@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.sendAnEmailButton:
            final Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("plain/text");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "" });
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.exception_stack_trace));
            intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(message + "<br />" + stackTraceMessage));
            startActivity(intent);
            break;
        case R.id.copyToClipboardButton:
            ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied Text", Html.fromHtml(message + "<br />" + stackTraceMessage));
            clipboard.setPrimaryClip(clip);
            Toast.makeText(this, getResources().getString(R.string.exception_clipboard_message), Toast.LENGTH_SHORT).show();
            break;
    }
}
 
開發者ID:ABTSoftware,項目名稱:SciChart.Android.Examples,代碼行數:19,代碼來源:ExceptionActivity.java

示例3: setSendMail

private void setSendMail(int numbers)
{
	String[] recipient = {"[email protected]"};
	String[] balises =
	{
		getStringSrc(R.string.mail_question), 
		getStringSrc(R.string.mail_suggestion), 
		getStringSrc(R.string.mail_bug)
	};
	String sous_sujet = getStringSrc(R.string.app_name) + ": " + balises[numbers];

	Intent email = new Intent(Intent.ACTION_SEND, Uri.fromParts("mailto", "[email protected].com", "null"));
	email.setType("text/plain");
	email.putExtra(Intent.EXTRA_EMAIL, recipient);
	email.putExtra(Intent.EXTRA_SUBJECT, sous_sujet);
	email.putExtra(Intent.EXTRA_TEXT, edit.getText().toString());
	try
	{
		startActivity(Intent.createChooser(email, getStringSrc(R.string.toast_mail_choose_plarforme)));
	} 

	catch (ActivityNotFoundException ex)
	{
		Preferences.longToast(ActivityContact.this, getStringSrc(R.string.toast_mail_send_failed));
	}
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:26,代碼來源:ActivityContact.java

示例4: share

@OnClick(R.id.btn_share)
void share(){
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, "分享");
    intent.putExtra(Intent.EXTRA_TEXT, "來自「嗶哩嗶哩」的分享:" + mVideoDetailsInfo.getDesc());
    startActivity(Intent.createChooser(intent, mVideoDetailsInfo.getTitle()));
}
 
開發者ID:MUFCRyan,項目名稱:BilibiliClient,代碼行數:8,代碼來源:VideoIntroductionFragment.java

示例5: onClickFeedBack

@OnClick(R.id.feedback)
public void onClickFeedBack() {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("plain/text");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[]{getString(R.string.my_email)});
    intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.mail_subject));
    startActivity(Intent.createChooser(intent, ""));
}
 
開發者ID:vixir,項目名稱:Perfect-Day,代碼行數:8,代碼來源:MoreInfoFragment.java

示例6: shareText

public static void shareText(Context context, String content) {
    if (TextUtils.isEmpty(content)) {
        Toast.makeText(context, "文字為空。", Toast.LENGTH_SHORT).show();
    }
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT, content);
    intent.setType("text/plain");
    Intent chooser = Intent.createChooser(intent, content);
    context.startActivity(chooser);
}
 
開發者ID:SailFlorve,項目名稱:RunHDU,代碼行數:10,代碼來源:ShareUtil.java

示例7: shareText

public static void shareText(Activity activity, final String title, final String text) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, "分享:" + title);
    intent.putExtra(Intent.EXTRA_TEXT, title + " " + text);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(Intent.createChooser(intent, "選擇分享"));
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:8,代碼來源:RUtils.java

示例8: shareFile

public static void shareFile(Context context, String title, String filePath) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    Uri uri = Uri.parse("file://" + filePath);
    intent.setType("*/*");
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    context.startActivity(Intent.createChooser(intent, title));
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:7,代碼來源:FileUtils.java

示例9: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    initFragment();
    //display the fragment home witout any value


    //init the sensors
    sensorManager=(SensorManager) getSystemService(SENSOR_SERVICE);
    sensor_pulse=sensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
    sensor_step=sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR);
    //register the sensors
    sensorManager.registerListener(this,sensor_step,SensorManager.SENSOR_DELAY_NORMAL);
    //activate a thread for the pulse sensors


        //process information: 30 sec
        //stop time= 30 min
        threadPulse=new SensorsThreadLifecircle(this,sensor_pulse,30000,1000*60*30);
        threadPulse.start();

    displayFragmentHome();

    // Register the local broadcast receiver. make the ling between the Service and the view
    IntentFilter messageFilter = new IntentFilter(Intent.ACTION_SEND);
    MessageReceiver messageReceiver = new MessageReceiver();
    LocalBroadcastManager.getInstance(this).registerReceiver(messageReceiver, messageFilter);

}
 
開發者ID:kflauri2312lffds,項目名稱:Android_watch_magpie,代碼行數:30,代碼來源:HomeActivity.java

示例10: ShareMessage

/**
 * Shares a message using Android' built-in sharing.
 */
@SimpleFunction(description = "Shares a message through any capable " +
    "application installed on the phone by displaying a list of the available apps and " +
    "allowing the user to choose one from the list. The selected app will open with the " +
    "message inserted on it.")
public void ShareMessage(String message) {
  Intent shareIntent = new Intent(Intent.ACTION_SEND);
  shareIntent.putExtra(Intent.EXTRA_TEXT, message);
  shareIntent.setType("text/plain");

  // We cannot use Intent.createChooser(shareIntent, "Send using...") because it creates an
  // oversized pop up sharing window.
  this.form.startActivity(shareIntent);
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:16,代碼來源:Sharing.java

示例11: shareApp

public void shareApp()
{
    try {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_SUBJECT, "Facebook Video Downloader");
        String sAux = "\nDo you want to Download Facebook Videos ? .Install this App , Its Amazing :). \n\n";
        sAux = sAux + "https://play.google.com/store/apps/details?id=com.video.fb.facebookvideodownloaderpaid";
        i.putExtra(Intent.EXTRA_TEXT, sAux);
        startActivity(Intent.createChooser(i, "Share this App"));
    } catch(Exception e) {
        //e.toString();
    }
}
 
開發者ID:adarshgumashta,項目名稱:Facebook-Video-Downloader,代碼行數:14,代碼來源:MainActivity.java

示例12: createTextIntent

/**
 * Create an intent with an extra of {@link Intent#EXTRA_TEXT} and an action of {@link Intent#ACTION_SEND}.
 *
 * @param text the text the Intent carries.
 * @return an intent carrying the text with a SEND action.
 */
private Intent createTextIntent(String text) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/*");
    intent.putExtra(Intent.EXTRA_TEXT, text);
    return intent;
}
 
開發者ID:Mindjet,項目名稱:LiteReader,代碼行數:12,代碼來源:ShareManager.java

示例13: onNavigationItemSelected

@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    switch (item.getItemId()) {
        case R.id.nav_menu_home:
            startActivity(new Intent(BaseActivity.this, HomeActivity.class));
            break;
        case R.id.nav_menu_movies:
            createBackStack(new Intent(BaseActivity.this, MoviesActivity.class));
            break;
        case R.id.nav_menu_tv:
            createBackStack(new Intent(BaseActivity.this, TvActivity.class));
            break;
        case R.id.nav_menu_discover:
            createBackStack(new Intent(BaseActivity.this, DiscoverActivity.class));
            break;
        case R.id.nav_menu_feedback:
            Intent sendMessage = new Intent(Intent.ACTION_SEND);
            sendMessage.setType("message/rfc822");
            sendMessage.putExtra(Intent.EXTRA_EMAIL, new String[]{
                    getResources().getString(R.string.feedback_email)});
            try {
                startActivity(Intent.createChooser(sendMessage, "Send feedback"));
            } catch (android.content.ActivityNotFoundException e) {
                Toast.makeText(BaseActivity.this, "Communication app not found",
                        Toast.LENGTH_SHORT).show();
            }
            break;
        case R.id.nav_menu_settings:
            createBackStack(new Intent(BaseActivity.this, SettingsActivity.class));
            break;

        case R.id.nav_menu_talk:
            startActivity(new Intent(BaseActivity.this, MainActivity.class));
            break;
        case R.id.nav_menu_donation:
            DonationDialog dialog = DonationDialog.newInstance();
            dialog.show(getFragmentManager(), "bitcoinDonationDialog");
            break;
    }

    mDrawerLayout.closeDrawer(GravityCompat.START);
    return true;
}
 
開發者ID:ansarisufiyan777,項目名稱:Show_Chat,代碼行數:43,代碼來源:BaseActivity.java

示例14: getShareImageIntent

/**
 * 獲取分享圖片的意圖
 *
 * @param content 分享文本
 * @param uri     圖片uri
 * @return intent
 */
public static Intent getShareImageIntent(final String content, final Uri uri) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT, content);
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    intent.setType("image/*");
    return intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:IntentUtils.java

示例15: shareText

public static void shareText(Context context,String text,String title){
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT,text);
    context.startActivity(Intent.createChooser(intent,title));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:ShareUtil.java


注:本文中的android.content.Intent.ACTION_SEND屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。