在列表视图中调用意图

发布于 2024-12-05 05:19:30 字数 152 浏览 0 评论 0原文

我正在开发 Android 应用程序。我正在使用网络服务来检索应用程序中的数据。现在,在我的功能之一中,我获取员工的完整详细信息并将其显示在列表视图中。现在,在列表视图中,有某些电话号码(超过 2 个)是他们的。现在我想使用呼叫意图,是否可以在列表视图中使用,如果可以,请告诉我方法。谢谢。

I am developing android application. I am using the web service to retrive the data in my application. Now in one of my function i fetch the employee's full detail and display it in the list view. Now in list view there are certain phone numbers (More then 2)are their. Now i want to use call intent is it possible in the list view if yes let me know the way.Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦中的蝴蝶 2024-12-12 05:19:30
onlistitemclick you enter below code as per position.............  



                    AlertDialog.Builder alertbox = new AlertDialog.Builder(
                            Contact.this);
                    alertbox.setTitle("Calling...");
                    alertbox.setMessage("773-288-1456");

                    alertbox.setPositiveButton("Call",
                            new DialogInterface.OnClickListener() {

                                // do something when the button is clicked
                                public void onClick(DialogInterface arg0, int arg1) {
                                    Intent callIntent = new Intent(
                                            Intent.ACTION_CALL);
                                    callIntent.setData(Uri
                                            .parse("tel:773-288-1456"));
                                    startActivity(callIntent);
                                }
                            });

                    // set a negative/no button and create a listener
                    alertbox.setNegativeButton("Cancel",
                            new DialogInterface.OnClickListener() {

                                public void onClick(DialogInterface arg0, int arg1) {

                                }
                            });

                    // display box
                    alertbox.show();
onlistitemclick you enter below code as per position.............  



                    AlertDialog.Builder alertbox = new AlertDialog.Builder(
                            Contact.this);
                    alertbox.setTitle("Calling...");
                    alertbox.setMessage("773-288-1456");

                    alertbox.setPositiveButton("Call",
                            new DialogInterface.OnClickListener() {

                                // do something when the button is clicked
                                public void onClick(DialogInterface arg0, int arg1) {
                                    Intent callIntent = new Intent(
                                            Intent.ACTION_CALL);
                                    callIntent.setData(Uri
                                            .parse("tel:773-288-1456"));
                                    startActivity(callIntent);
                                }
                            });

                    // set a negative/no button and create a listener
                    alertbox.setNegativeButton("Cancel",
                            new DialogInterface.OnClickListener() {

                                public void onClick(DialogInterface arg0, int arg1) {

                                }
                            });

                    // display box
                    alertbox.show();
一个人的旅程 2024-12-12 05:19:30

使用

onItemClickListener

listView 的

并在其中调用您想要的意图

点击

它的

use

onItemClickListener

of the listView and call the intent you want in the

onClick

method of it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文