android - Dialing in ListView -


i have basic app shows list view of items , when clicked toast generated saying clicked on .... want dial given phone numbers when clicked. here code

    customclicklistener listener = new            customclicklistener();     tableview.setclicklistener(listener);     tableview.addbasicitem("example 1", "summary text 1");     tableview.addbasicitem("example 2", "summary text 2");     tableview.addbasicitem("example 3", "summary text 3");     tableview.addbasicitem("example 4", "summary text 4");     tableview.addbasicitem("example 5", "summary text 5");     tableview.addbasicitem("example 6", "summary text 6");     tableview.addbasicitem("example 7", "summary text 7");     tableview.addbasicitem("example 8", "summary text 8");       tableview.addbasicitem("example 9", "summary text 9");     tableview.addbasicitem("example 10", "summary text 10");     tableview.addbasicitem("example 11"); }  private class customclicklistener implements clicklistener {      @override     public void onclick(int index) {         toast.maketext(example1activity.this, "item clicked: " + index, toast.length_short).show(); 

possible duplicate of: how make phone call programmatically?

intent intent = new intent(intent.action_call);  intent.setdata(uri.parse("tel:" + phonenumber)); context.startactivity(intent); 

don't forget add relevant permission manifest:

<uses-permission android:name="android.permission.call_phone" /> 

in case, might this:

private class customclicklistener implements clicklistener {      @override     public void onclick(int index) {         intent intent = new intent(intent.action_call);          // don't know custom tableview...         string phonenumber = tableview.getitemat(index).getphonenumber();          intent.setdata(uri.parse("tel:" + phonenumber);         exampleactivity.this.startactivity(intent);     } } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -