anybody give me a hand plaese..
I can login to PokemonGO without asynctask in Eclipse But in Android Studio i did it in asynctask but my app alway crash can someone give me an example code to login with Android Studio please.. Thank you
provide stacktrace please
this is my simple code to test, but it's not work like i said. what i missed?
`public class MainActivity extends AppCompatActivity { OkHttpClient httpClient = new OkHttpClient(); PokemonGo go = new PokemonGo(httpClient); PlayerProfile profile; TextView text1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text1=(TextView)findViewById(R.id.text1); new login().execute();
}
private class login extends AsyncTask<Void, Integer, String> {
protected void onPreExecute() {
}
protected String doInBackground(Void... params) {
try {
go.login(new PtcCredentialProvider(httpClient, "tsitpogo", "tsitpogo"));
profile = go.getPlayerProfile();
} catch (LoginFailedException e) {
e.printStackTrace();
} catch (RemoteServerException e) {
e.printStackTrace();
}
String user = profile.getPlayerData().getUsername();
return user;
}
protected void onPostExecute(String result) {
Toast.makeText(MainActivity.this,result,Toast.LENGTH_LONG).show();
}
}`
Nobody can help you with out the stack trace.
these isn't error or exception, app just crash
