Android 在列表视图中调用意图

Android 在列表视图中调用意图,android,listview,android-intent,Android,Listview,Android Intent,我正在开发android应用程序。我正在使用web服务检索应用程序中的数据。现在,在我的一个函数中,我获取员工的全部详细信息,并将其显示在列表视图中。现在在列表视图中,某些电话号码(多于2个)是他们的。现在我想使用call intent。如果可以,请在列表视图中告诉我路。谢谢。使用 麦克利克监听器 ,并在 onClick 方法。但我在列表视图中有多个数字。一名员工有多个数字。我使用了4行,其中3行显示数字。您在listview中得到的位置第一行位置为零,使用switch语句您可以得到每一行的值。

我正在开发android应用程序。我正在使用web服务检索应用程序中的数据。现在,在我的一个函数中,我获取员工的全部详细信息,并将其显示在列表视图中。现在在列表视图中,某些电话号码(多于2个)是他们的。现在我想使用call intent。如果可以,请在列表视图中告诉我路。谢谢。

使用

麦克利克监听器

,并在

onClick


方法。

但我在列表视图中有多个数字。一名员工有多个数字。我使用了4行,其中3行显示数字。您在listview中得到的位置第一行位置为零,使用switch语句您可以得到每一行的值。。。。。。。
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();