Skip to content Skip to sidebar Skip to footer

How To Display Different Json String In Listiview?

I am using json parsing in my app,i am getting following response,and i want to display name from my response to listiview,but my app got crash,can any one tell me what is the mist

Solution 1:

listiview nothing is displaying

Because have following issues in current code:

1. Not initializing ArrayList before adding items in it. do it as:

private ArrayList<String> statedata=new ArrayList<String>();

2. Because problem is getView method :

@Overridepublic View getView(finalint position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        ...
        holder.tv=(TextView) rowView.findViewById(R.id.frndsfamly_name);
        //set text to TextView from listData
        holder.tv.setText(listData.get(position));
        return rowView;
    }

Solution 2:

In your getView() method

holder.tv.setText(listData.get(position));

is missing. You don't set any text in text view. That is why it is empty

Post a Comment for "How To Display Different Json String In Listiview?"