Update ListView item after Callback

0

In my application, I use SDK of Parse.com . The SDK provides a method for loading API objects in assíncrona and in another thread named fetchInBackground() . Within getView() of my adapter the following happens:

ParseObject driver = object.getParseObject("object");
    driver.fetchInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject parseObject, ParseException e) {
            if(e==null){
                item.name.setText(parseObject.getString("name"));
                notifyDataSetChanged();
            }
        }
});

I'm trying to set the name in item.name which is a TextView , but the name only appears when I roll the list and return, in case when I reload the item.

    
asked by anonymous 09.09.2016 / 05:11

1 answer

0

Try to use

     View v = suaListView.getChildAt(position);
     TextView textView = (TextView) v.findViewById(R.id.idSuaTextView);
     textView.setText(parseObject.getString("name");

Or use RecyclerView and RecyclerView.Adapter in the

    onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int position){
        MyViewHolder holder = (MyViewHolder) viewHolder;

        holder.seuTextView.setText("Texto atualizado");

        notifyItemChanged(position);
     }

link

I hope I have helped:)

    
09.09.2016 / 13:54