Android:消息意图 [英] Android : Message Intent

查看:76
本文介绍了Android:消息意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android的初学者.我需要知道是否有意打开创建消息窗口.我尝试使用此代码-

I'm a beginner to android. I need to know is there any intent to open the Create Message window. I tried with this code -

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");

但是,它引发了,Gmail, Email & Message我只需要引发一条消息.在我的应用程序中,当我按下按钮时,我必须将其集成.有人知道吗?指导我.

But, it raises, Gmail, Email & Message I need to raise only message. In my application i've to integrate this when i press the button. Can anybody know this? Guide me.

推荐答案

您可以在xml文件中添加

You can just in your xml file add

android:onClick = "onClick" 

和活动中:

//main buttons listener
public void onClick(View view)
{
    switch (view.getId())
    {
            case R.id.sms:
            Intent intentsms = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:" + "" ) );
            intentsms.putExtra( "sms_body", "Test text..." );
            startActivity( intentsms );
            break;
    }
} 

这篇关于Android:消息意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆