1

I am a new user baasbox, and now, I have some problems that how I get one document that is stored in my dashboard and set them in a ListView in my app, I have already read the Documentation of BaasBox, but there don't have one full code to I base my app, I already got create and save a document from my app to my BaasBox, but I can't do it inverse.

here is the BaasBox Retrieve documents:

http://www.baasbox.com/documentation/?java#retrieve-documents

I don't use filters in my code to simplify my tests.

Here is My Code:

public class ListDadosActivity extends AppCompatActivity {

ListView myList;

private String[] listNames;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_dados);

    documentsTaker();

    myList = (ListView) findViewById(R.id.listView);

    ArrayAdapter<String> myAdaptor = new ArrayAdapter<String>(
            getApplicationContext(),
            android.R.layout.simple_list_item_1,
            android.R.id.text1,
            listNames
    );
    myList.setAdapter(myAdaptor);

}


public void documentsTaker() {

    BaasDocument.fetchAll("dados",
            new BaasHandler<List<BaasDocument>>() {
                @Override
                public void handle(BaasResult<List<BaasDocument>> res) {

                    if (res.isSuccess()) {
                        for (BaasDocument doc : res.value()) {
                            Log.d("LOGX", "Doc: " + doc);
                        }
                    } else {
                        Log.e("LOGY", "Error", res.error());
                    }
                }
            });
    }

}

I want to fill the var ListNames with Strings that is stored in my BaasBox.

My LOGX Appears: com.baasbox.android.BaasDocument@53720d20

Sorry for my Poor English.

Hank
  • 4,236
  • 5
  • 39
  • 76

0 Answers0