kumar kundan kumar kundan - 1 year ago 109
Android Question

Java - How to Retrieve and use a single value from azure mobile services in Android

I am new to azure but i know certain things like how to retrieve and store data to azure , i followed azure official documentation for this purpose.

Link is Here - https://azure.microsoft.com/en-in/documentation/articles/mobile-services-android-get-started-data/

But the problem is, this tutorial is only showing How to retrieve and use Data from azure using Adapters and Lists . I want to know , How can i retrieve a single value from azure mobile services and how to use it in android.

Plzz provide me both backend code (if there is any) and java code for this . THANKS in advance

Answer Source

I got it solved. No need to create a custom API.

Just follow the basics , Here is the code :-

final String[] design = new String[1];

private MobileServiceTable<User> mUser;

mUser = mClient.getTable(User.class);

            new AsyncTask<Void, Void, Void>() {
                protected Void doInBackground(Void... params) {
                    try {
                        final MobileServiceList<User> result =
                        for (User item : result) {
                           // Log.i(TAG, "Read object with ID " + item.id);
                            desig[0] = item.getDesignation(); //getDesignation() is a function in User class ie- they are getters and setters
                            Log.v("FINALLY DESIGNATION IS", desig[0]);


                    } catch (Exception exception) {
                    return null;

                protected void onPostExecute(Void aVoid) {

DON'T forget to create a class User for serialization and all. Also you should define the array .

FEEL FREE to write if you got it not working.


design[0] is an array with size 1.

eq(x) is equal to x where , x variable contains username for which i want designation from database (azure).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download