public void onClick(View arg0) {
AsyncTask<Void, Void, String> tarefa;
tarefa = new AsyncTask<Void, Void, String> () {
@Override
protected String doInBackground(Void... params) {
Http req = new Http();
try{
String resultado = req.doGet("http://www.revistagamemais.com.br/app_venturini/autentica_usuarios.php?login=admin&senha=1243");
//String fim = "1";
Log.d("<<< ID >>>",""+resultado);
return resultado;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
try{
String codigo = String.valueOf(result);
//int codigo = Integer.parseInt(result);
if(codigo == "0"){
Toast.makeText(getActivity(), "Usuario não existe", Toast.LENGTH_SHORT).show();
}else{
Intent chamada = new Intent(getActivity(),PostoActivity.class);
startActivity(chamada);
}
}catch(Exception e){
Toast.makeText(getActivity(), "Servidor com Problemas", Toast.LENGTH_SHORT).show();
}
}
};
tarefa.execute(new Void[0]);
}
}
Obrigado a todos!
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.






0 comentários:
Postar um comentário