Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending ACTION_CALL Intent in Android containing hash # sign

I am having the problem that the hash sign is truncated. Does anybody know a solution? using unicode or %23 is not working in my case. Now the number that is dialed is *101

String uri = "tel:" + "*101#";

//String uri = "tel:" + "*101\u0023";

Intent intent;
intent = new Intent(Intent.ACTION_CALL, Uri.parse(uri));
like image 737
GZA Avatar asked Sep 02 '11 07:09

GZA


3 Answers

Found a solution: String encodedHash = Uri.encode("#"); this did the trick...

like image 135
GZA Avatar answered Nov 12 '22 20:11

GZA


I found a solution for this issue by replacing # in %23

String uri = "tel:" + "*133%23";

Intent intent;
intent = new Intent(Intent.ACTION_CALL, Uri.parse(uri));
like image 20
user1409807 Avatar answered Nov 12 '22 21:11

user1409807


This 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)));
like image 32
Ray Avatar answered Nov 12 '22 19:11

Ray