分享,发送;AlertDialog自定义布局文件

    技术2022-05-19  18

    发送为短信息内容

    Intent i = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("sms", "", null)); i.putExtra("sms_body", cur.getString(3)); EditNote.this.startActivity(i);

     

    发送电子邮件

    Intent i = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "", null)); EditNote.this.startActivity(i);

     

    应用程序自动检测:

    Intent intent=new Intent(Intent.ACTION_SEND);             intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);             intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);             intent.setType("text/plain");             intent.putExtra(Intent.EXTRA_TEXT,cur.getString(3));             EditNote.this.startActivity(Intent.createChooser(intent, getString(R.string.dialog_send)));

     

    对话框添加布局:AlertDialog

    LayoutInflater inflater = LayoutInflater.from(this);         final View choiceView = inflater.inflate(R.layout.choice_activity, null);                       AlertDialog mAlertDialog = new AlertDialog.Builder(this)         .setTitle(R.string.search_widget)               .setView(choiceView)         .create();         mAlertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {             public void onDismiss(DialogInterface dialog) {                 SearchWidgetConfigActivity.this.finish();             }         });               mAlertDialog.show();


    最新回复(0)