Skip to content

Instantly share code, notes, and snippets.

@TomTasche
Last active April 25, 2016 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomTasche/e574b4d98269f6533405 to your computer and use it in GitHub Desktop.
Save TomTasche/e574b4d98269f6533405 to your computer and use it in GitHub Desktop.
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;
}
}
@MrVasilev
Copy link

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment