I have a problem with the hash sign truncated. Does anyone know a solution? using unicode or% 23 does not work in my case. Now dialed number - 101
String uri = "tel:" + "*101#"; //String uri = "tel:" + "*101\u0023"; Intent intent; intent = new Intent(Intent.ACTION_CALL, Uri.parse(uri));
Solution found: String encodedHash = Uri.encode ("#"); it did the trick ...
I found a solution for this problem by replacing # in% 23
String uri = "tel:" + "*133%23"; Intent intent; intent = new Intent(Intent.ACTION_CALL, Uri.parse(uri));
That would be easier:
String no = textview.getText().toString(); if(no.contains("#")){ no = no.replace("#","%23"); } startActivity(new Intent(Intent.ACTION_CALL) .setData(Uri.parse("tel:" no)));
All in one solution:
String number = "*123#"; number = number.replace("*", Uri.encode("*")).replace("#",Uri.encode("#")); Intent mIntent = new Intent(Intent.ACTION_CALL); Uri data = Uri.parse("tel:" + number); mIntent.setData(data); startActivity(mIntent);