Skip to content Skip to sidebar Skip to footer

Android:username And Password Login Using Httppost

I'm using eclipse and have been trying for a while to do login using http request and php script to connect to the server side. The problem is when i click the login button nothing

Solution 1:

You should debug to check if the problem is with the onClick or with the HTTP transport. Inside onClick I personally wouldn't check view like yours. Not sure if it's working or not but I usually use:

if(null != view)switch(view.getId()){
    case R.id.btn_login: postLoginData();break;
}

You should try to scope down where the problem is so it's clear what need fixing. I'd suggest you add Log.d right after you enter onClick to see if the listener is invoke when you click the screen.

Solution 2:

Consider using Log.d(TAG, message) statements to debug your code. The logs can be seen using `adb logcat' or eclipse DDMS. This should tell you the flow of your code. You can also debug using breakpoints in eclipse.

Also, do not perform network I/O in the main loop. Its really bad for you users. Consider using an AsyncTask

Post a Comment for "Android:username And Password Login Using Httppost"