如何允许用户从列表中进行选择以拨打电话

时间:2015-06-23 00:52:27

标签: android android-listview call

String [] AgricultureNumbers ={
        "Administration           347-648-2999 ",
        "Legal office             347-895-3456",
        "Permanent Secatery       347-852-6665"
};
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,AgricultureNumbers);
        setListAdapter(adapter);

    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);

        Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "347-648-2999"));
        startActivity(intent);
    }

}

我希望用户拨打所选号码,但只拨打347-648-2999.任何帮助都将不胜感激。

0 个答案:

没有答案