Display every users id in a listview

This is my code. Could anybody please point out the error because the code ain’t working…

public class secactivity extends Activity {
String[] s;

ListView lv;

protected void onCreate(Bundle savedInstanceState)
Backendless.Data.of( BackendlessUser.class ).find( new AsyncCallback<BackendlessCollection<BackendlessUser>>()
public void handleResponse( BackendlessCollection<BackendlessUser> u2 )
Iterator<BackendlessUser> userIterator = u2.getCurrentPage().iterator();
while( userIterator.hasNext() )
BackendlessUser user = userIterator.next();

public void handleFault( BackendlessFault backendlessFault )
System.out.println( "Server reported an error - " + backendlessFault.getMessage() );
} );
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, s);

     // Assign adapter to ListView


Hi, Android fan!

What is specifically not working? Is it a Backendless issue?

You can try our Android Codegeneration sample to understand why your code is not working:
Go to Backendless Console, choose CodeGeneration, Android, choose your IDE and check Data Management checkboxes. Press Download Project below.


I am trying to fetch users id from users table in backendless and store it in a string array ‘s’.
As you can see here-
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, s);

I have passed the string array s to display it in the listview…but its not working…i do not understand where the problem is??
is there something wrong with the code fetching the users id’s and storing it in string array or something else??

Please check first the CodGeneration sample for Data Management. If it works for you then it’s an issue with the code itself, not Backendless.


I went through the CodeGeneration sample that you recommended. I am new to android as well as to backendless. I am unable to find the CodeGeneration sample of any help to me. Sir, if you could help me, I would be greatly thankful to you.

I’ve checked your code - the Backendless part works fine - you receive the BackendlessCollection of BackendlessUsers.



You try to write a String object into a String[] object ( s ).

I guess what you wanted to do is: s = (String) user.getProperty(“Smartcard_id”)

Anyway, the Backendless part works fine. So the issue is out of scope of this support.