Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Re: Pegar o tipo de número que está ligando

Vou fazer a tentativa Pedro. Só uma dúvida: onde eu passo nessa função o número do telefone que está me ligando para fazer o teste?
Muito obrigado.

Em 18/08/2015 08:43, "pedrofsn" <pedrokra@gmail.com> escreveu:
// Tentativa para desccobrir se é fixo ou móvel
Boolean isCelular;
try {
int pos;
Character premiumDigit = null;
if ((pos = str.indexOf(")")) != -1) {
str = str.substring(pos + 1);
}
for (pos = 0; pos < str.length(); pos++) {
if (isDigit(str.charAt(pos)))
break;
}
if (pos < str.length()) {
char ch = str.charAt(pos);
if (ch == '0' && pos + 3 < str.length()) {
premiumDigit = str.charAt(pos + 3);
} else
premiumDigit = ch;
}
if (premiumDigit == null)
isCelular = null;
else {
char ch = premiumDigit;
isCelular = ch > '5';
}
} catch (Exception e) {
isCelular = null;
}
if (isCelular == null) {
holder.expandableRowIcon.setVisibility(View.GONE);
} else if (isCelular) {
holder.expandableRowIcon.setVisibility(View.VISIBLE);
holder.expandableRowIcon.setImageResource(R.drawable.icon_inf_cel);
} else {
holder.expandableRowIcon.setVisibility(View.VISIBLE);
holder.expandableRowIcon.setImageResource(R.drawable.icon_inf_tel_fix);
}

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário