Retrieve relational data from Parser.com and display within a listview

0

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

    comentario = (EditText) findViewById(R.id.text_comentario);
    botaoSalvar = (Button) findViewById(R.id.button_salvar);


    //passando uma foto da galeria para a imageviewe


    Intent i = getIntent();
    obID = i.getStringExtra("imagem");



    adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, resultsAsString);

    ParseQuery<ParseObject> query = ParseQuery.getQuery("comentario");
    query.whereEqualTo("parentesco", obID);
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> commentList, ParseException e) {

            if (e==null){

                resultsAsString = new String[commentList.size()];
                for(int index = 0; index < commentList.size(); index++){

                    resultsAsString[index] = commentList.get(index).getString("comentario");
                }
                adapter.notifyDataSetChanged();

            } else {
                Log.w("Parse query", e.getMessage());
            }
        }
    });

    listView = (ListView) findViewById(R.id.lvComentario);
    listView.setAdapter(adapter);

Can anyone help me?

    
asked by anonymous 18.05.2018 / 06:28

0 answers