dimanche 28 décembre 2014

Android: Unable to make http request


Vote count:

0




I have user's username and password save in db, now I want to auto-login user silently/async way by making http request to authenticateUser method from this class:


In activity onCreate:



// userMobile and userPassword come from sqlite db

Thread thread = new Thread() {
@Override
public void run() {
try {

// AUTHENTICATE USER WHEN ACTIVITY OPENS
imService
.authenticateUser(userMobile, userPassword);

} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

}
};

thread.start();


But I am getting NullPointerException at line:



imService.authenticateUser(userMobile, userPassword);


I have verified that userMobile and userPassword are not empty.


It is interesting to note that same code works on explict button click event but not without any trigger eg not working inside onCreate method.


Any help will be greatly appreciated. Thanks



asked 17 secs ago

Dev01

722






Android: Unable to make http request

Aucun commentaire:

Enregistrer un commentaire