-
-
Save TomTasche/e574b4d98269f6533405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EndpointsTask extends AsyncTask<Context, Integer, Long> { | |
protected Long doInBackground(Context... contexts) { | |
Userendpoint.Builder endpointBuilder = new Userendpoint.Builder( | |
AndroidHttp.newCompatibleTransport(), | |
new JacksonFactory(), | |
new HttpRequestInitializer() { | |
public void initialize(HttpRequest httpRequest) { } | |
}); | |
Userendpoint endpoint = CloudEndpointUtils.updateBuilder( | |
endpointBuilder).build(); | |
try { | |
String username = "INSERT_USERNAME_HERE_DUDE!"; | |
User user = endpoint.getUser(username).execute(); | |
usernameTextView.setText(user.getUsername()); | |
locationTextView.setText(user.getLocation()); | |
ageTextView.setText(user.getAge()); | |
occupationTextView.setText(user.getOccupation()); | |
weightTextView.setText(user.getWeight()); | |
genderTextView.setText(user.getGender()); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
return (long) 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recently I start an Android project with GAE and I think it is not good idea to use @entity classes from back-end part (for example User, Car and etc.) into Android app part. I guess it is good practice to separate the back-end and front-end functionality, so my questions are:
How we have to separate Entity classes (for example User, Car and etc.) from back-end (GAE) and front-end (Android app) ?
What response we have to return from back-end to android app when we want to get some Entity (for example User, Car and etc.) data and what arguments we have to pass from android app to back-end (some Endpoint)?