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
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);
}
});
拿一个包含手机号码的字符串“mobNo”,然后删除第一个和第四个字符,然后调用你的方法。
i.setData(Uri.parse("tel:"+mobNo);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.