当我从web获取JSON数据时,显示包名称而不是字符串名称。我认为错误是在像getItem,getposition等包com.bibek.json这样的方法上; 当我把日志显示的错误是 10-27 15:59:29.914 7611-7611 / com.bibek.json V / hari:hehecom.bibek.json.data.SongModel@f515d9d 10-27 15:59:29.964 7611-7611 / com.bibek.json V / hari:hehecom.bibek.json.data.SongModel@cc96a4f 10-27 15:59:30.034 7611-7611 / com.bibek.json V / hari:hehecom.bibek.json.data.SongModel@f1e15d3
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.bibek.json.data.SongModel;
import java.util.ArrayList;
import java.util.List;
/**
* Created by User on 10/27/2016.
package com.example.shailendra.navigaiontab;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by Shailendra on 10/19/2016.
*/
public class CustomAdapter extends ArrayAdapter{
TextView textView5;
private List data;
public CustomAdapter(Context context, List<SongModel> s) {
super(context, R.layout.row,s);
data=s;
}
@Override
public int getCount() {
return data.size();
}
@Override
public Object getItem(int position) {
return super.getItem(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getPosition(Object item) {
return getPosition(item);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater newInflator= LayoutInflater.from(getContext());
View customView= newInflator.inflate(R.layout.row,parent,false);
String myitem= getItem(position).toString();
textView5=(TextView)customView.findViewById(R.id.songId);
// ImageView imageView=(ImageView)convertView.findViewById(R.id.imageView2);
textView5.setText(myitem);
Log.v("hari ", "hehe" + myitem);
return customView;
}
}