I have this part of my code where I call a class to add '0' to a group of characters that must have 4 characters.
StringTokenizer frase = new StringTokenizer(IMEIstring,".");
String first = frase.nextToken();
if(first.length()<4){
AddOh instancia = new AddOh();
String primeiro = instancia.AddZero(first);
first = primeiro;
}
But it does not call the class, it gives error. In Logcat nothing appears and when I do Debug it looks like this:
BelowthefullcodeoftheAddOhclass:(Oh,ifIputitinsidethemainclassasaninternalfunctionandItrycallingitwithoutinstanceitalsodoesnotrun)
packagecom.example.minhaslicencasnobre;publicclassAddOh{publicStringAddZero(Stringpedaco){Stringfim=null;String[]H=null,finish,temp;inti,j=0;finish=newString[4];temp=newString[4];if(pedaco.length()<4){inttam=pedaco.length();for(i=0;i<pedaco.length();i++)H[i]=pedaco.substring(i,i+1);for(i=3;i>=0;i--){if(i<tam){temp[i]=H[j];j++;}elsetemp[i]="0";
}
j=temp.length-1;
for(i=0;i<temp.length;i++){
finish[i] = temp[j];
j--;
}
}
for(i=0;i<=finish.length;i++){
fim = fim + finish[i];
}
return fim;
}
}