ANDROID:单击按钮时添加通话功能 [英] ANDROID : adding call function when a button clicked

查看:76
本文介绍了ANDROID:单击按钮时添加通话功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个片段中添加了一个ListView,当单击该Listview时,我看到单个itemview.当我单击该单个项目视图中的按钮时,呼叫应转到列表视图中的特定ID.按钮用于呼叫,当它被点击并自动校准时应该进入.我的代码已关闭,电话号码存储在侧面解析服务器中.如果有人知道,请帮助

I have added a ListView inside a fragment, when clicking that listview i see single itemview. when i click the button in that single item view a call should go to that particular id in the listview. button is for call , when its clicked and automatic cal should go . my code is down , phone numbers are stored in side parse server. if anyone knows please help

btn = (Button) findViewById(R.id.button56) ;
btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String phno="telephone";

            Intent i=new Intent(Intent.ACTION_DIAL,Uri.parse(phno));
            startActivity(i);
        }
});

xml代码

   <Button
            android:id="@+id/button56"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="TELE PHONE"

            android:layout_weight="1"
            android:background="#EFEFEF"/>

推荐答案

尝试使用,

Uri.parse("tel:" +number)

我认为您已经添加了权限,

and I assume you have added the permission,

.CALL_PHONE

在您的清单中.

这篇关于ANDROID:单击按钮时添加通话功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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