2011-09-02 7 views
8

Tengo el problema de que el signo hash está truncado. ¿Alguien sabe una solución? usar unicode o% 23 no funciona en mi caso. Ahora, el número que se marca es * 101Enviando ACTION_CALL intención en Android que contiene hash # signo

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

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

Intent intent; 
intent = new Intent(Intent.ACTION_CALL, Uri.parse(uri)); 

Respuesta

15

encontrado una solución: String encodedHash = Uri.encode ("#"); esto hizo el truco ...

+0

Gracias por eso :), buen hallazgo. – Warpzit

10

he encontrado una solución para este problema mediante la sustitución #% en 23

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

Intent intent; 
intent = new Intent(Intent.ACTION_CALL, Uri.parse(uri)); 
0

Una solución todo en uno sería:

  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); 
1

Esto sería más fácil ;

String no = textview.getText().toString(); 
if(no.contains("#")){ 
no = no.replace("#","%23"); 
} 
startActivity(new Intent(Intent.ACTION_CALL) 
.setData(Uri.parse("tel:" no))); 
Cuestiones relacionadas