1private Uri ussdToCallableUri(String ussd) {
2
3 String uriString = "";
4
5 if(!ussd.startsWith("tel:"))
6 uriString += "tel:";
7
8 for(char c : ussd.toCharArray()) {
9
10 if(c == '#')
11 uriString += Uri.encode("#");
12 else
13 uriString += c;
14 }
15
16 return Uri.parse(uriString);
17}
18
1String ussdCode = "*" + "123" + Uri.encode("#");
2startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + ussdCode)));
3
1String ussdCode = "*123#";
2Intent intent = new Intent(Intent.ACTION_CALL);
3intent.setData(ussdToCallableUri(ussdCode));
4try{
5 startActivity(intent);
6} catch (SecurityException e){
7 e.printStackTrace();
8}
9