开发者

Android JSON user registration

I'm in the process of building an Android application that interacts via a JSON API with my website. I've basically got everything together except for user registration on the app. I have an idea on how I want to implement it, but I want to see if there might be an easier way.

My approach is:

  1. When the RegisterActivity is started, display a loading indicator, and make an asynchronous JSON request (via google-gson) to the server get all the fields needed for registration.

  2. When the listener receives a response, populate the spinners, checkboxes, etc. with the possible registration field values.

  3. Allow the user to complete the form and submit via JSON.

You're probably thinking, "Why don't you just store the possible registration spinner/checkbox values in the app itself?" The possible values for each field will be changing over time as I co开发者_如何学编程ntinue to test/push the product, and I don't want to break a build simply because I added/removed some possible options on the server. This is why I'm dynamically building the form based upon a JSON request.

Given that, I'm wondering:

  • Am I thinking about this the wrong way?
  • If this is a good approach, is there a JAR or sample implementation someone has out there that already accomplishes this?


You could always just use a WebView and have your registration page written in HTML and hosted on your server. That simplifies things dramatically.

http://developer.android.com/guide/webapps/webview.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜