I am newbie in android .i want to develop an application w开发者_JAVA技巧hich has the username and password fields and a login button ,when i click the login button the username and password should be verified with the login name and password with the php function in database. can anyone of u pls provide me with the code..
i want to use the webserver.
You can use JSON as written above, but would be nice to use encoding on password when sending data...
If you use md5 encoding on your PHP server you should send md5 coded password to make it more simple...
I prefer this way... you make php file which reads $_GET parameters and is only for platform (u can detect platform on sever)... Than you can call URL by doing smth like this: http://yourserver.com/index.php?a=login&user=something&password=md5string... You can make a PHP file than to return JSON with data like loginOK = true / false, user's data (name, url to picture or whatever)...
Hope it helps!
Depending on your needs there might be built in account managing support in Android.
I would perhaps start of by having a peek on the AccountManager. The following link would be a good start I think.
http://developer.android.com/reference/android/accounts/AccountManager.html
You can use JSON for it refer to this link: How to send a http request by JSON in Android?
精彩评论