Reputation: 987
I'm loading the data into a RecyclerView. I want that after click on "mobile number string" it should be open in phone app without parenthesis means I want to open it in phone like a simple "Indian phone number". In my code it is open like this (879) 321-2686.
holder.tv_mobileno.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent(Intent.ACTION_DIAL);
i.setData(Uri.parse("tel:"+product.getMobileno()));
ctx.startActivity(i);
}
});
This is the image of the RecyclerView:
This is the output of phone app
Upvotes: 3
Views: 1467
Reputation: 4157
holder.tv_mobileno.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i=new Intent(Intent.ACTION_DIAL);
i.setData(Uri.parse("tel:" + "+91" + product.getMobileno())); // --> add +91
ctx.startActivity(i);
}
});
Upvotes: 1
Reputation: 127
Take a String "mobNo" which holds the mobile number and then delete the first and fourth character, then call your method.
i.setData(Uri.parse("tel:"+mobNo);
Upvotes: 0