Android app knows names of Backendless table and column. How to get data?

Without knowing what is in the table, but only knowing the name of the Backendless table and column, how can Android app fetch data from Backendless table?

Yes, please see the examples in the docs:


I created a Backendless app called Contact, then I used codeGen to make a download zip. I opened the zip and opened file in Android Studio. However, it failed to run on my phone and on the emulator with Nexus 5.

I want to use the example code in class Contact and the asynchronous method saveNewContact() to learn how to save info to a table in Backendless.
(Contact class in

Can you provide more details on the failure to run?

I managed to save data into Backendless table, now I am trying to retrieve that data. I don’t understand how.

The following code has compile errors, but shows what I am trying to do.


import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.backendless.Backendless;
import com.backendless.BackendlessUser;
import com.backendless.IDataStore;
import com.backendless.async.callback.AsyncCallback;
import com.backendless.exceptions.BackendlessFault;
import com.backendless.persistence.DataQueryBuilder;
import java.util.List;
import java.util.Map;

public class FindContactActivity extends Activity {

protected void onCreate(Bundle savedInstanceState) {

    Backendless.setUrl( Defaults.SERVER_URL );
    Backendless.initApp( getApplicationContext(), Defaults.APPLICATION_ID, Defaults.API_KEY );
void onFindContact() {

    IDataStore<Map> contactStorage = Backendless.Data.of( "Contact" );
    DataQueryBuilder queryBuilder = DataQueryBuilder.create();

    // set where clause
    queryBuilder.setWhereClause( "age < 30" );

    // set related columns
    queryBuilder.setRelated( "address", "phoneNumber" );

    // request sorting
    queryBuilder.setSortBy( "name" );

    //set offset and page size
    queryBuilder.setPageSize( 20 );
    queryBuilder.setOffset( 40 );

    contactStorage.find( queryBuilder, new AsyncCallback&lt;List&lt;Map&gt;>()
        public void handleResponse( List&lt;Map&gt; contactObjects )
            Log.i( "MYAPP", "Retrieved " + contactObjects.size() + " objects" );
            Toast.makeText(FindContactActivity.this,"Retrieved " + contactObjects.size() + " objects from Backendless table", Toast.LENGTH_LONG).show();

            BackendlessUser user = Backendless.UserService.CurrentUser();
            if( user != null )
                // get user's phone number (i.e. custom property)
                String phoneNumber = (String) user.getProperty( "phoneNumber" );
                Toast.makeText( FindContactActivity.this, String.format( "phone number: %s", phoneNumber ), Toast.LENGTH_LONG ).show();

                // get user's age (i.e. custom property)
                String age = (String) user.getProperty( "age" );
                Toast.makeText( FindContactActivity.this, String.format( "age: %s", age ), Toast.LENGTH_LONG ).show();

                // get user's adress (i.e. custom property)
                String adress = (String) user.getProperty( "adress" );
                Toast.makeText( FindContactActivity.this, String.format( "adress: %s", adress ), Toast.LENGTH_LONG ).show();

        public void handleFault( BackendlessFault fault )
            //Log.e( "MYAPP", "Server reported an error " + fault.getMessage );//compile error at 'getMessage'
            Toast.makeText(FindContactActivity.this,"Backendless Server reported an error ", Toast.LENGTH_LONG).show();
    //&lt;/Map&gt;  //compile error at '&lt;/map&gt;'



If you could provide details on the actual compiler errors, it would help us help you locate the problem…