当前位置: 首页>>代码示例>>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;未经允许,请勿转载。