Issue
I am having trouble with parsing a string that contains "#" in URI, I want to open Device Dial-Up and parse this string "*344*12*#" to it. the below code is my implementation and the problem is that I get the string without "#" in Dial-Up.
@Override
public void onBindViewHolder(@NonNull RecyclerAdapterDataView holder, int i) {
final String code = list.get(i).getActivation();
holder.activation.setText("Activation Code: "+code);
holder.activate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (code.contains("#")){
Intent i = new Intent();
i.setAction(Intent.ACTION_DIAL);
i.setData(Uri.parse("tel:"+code));
context.startActivity(i);
}
}
});
}
Solution
try below code this may help
if (code.contains("#")){
Intent i = new Intent();
i.setAction(Intent.ACTION_DIAL);
i.setData(Uri.parse("tel:"+Uri.encode(code))); //here add Uri.encode
context.startActivity(i);
}
Answered By - Omkar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.