我尝试对api json进行多线程发布请求,顺利进行一些线程,但很快就会从其中一个线程收到错误,
ValueError:无法解码JSON对象
我的代码:
# In your Adapter Class while inflating xml add a buttons as required
# and get the references for that buttons then write onClick on #that button in your getView method of Adapter
public View getView(int position,View view,ViewGroup parent) {
LayoutInflater inflater=context.getLayoutInflater();
View rowView=inflater.inflate(R.layout.mylist, null,true);
TextView txtTitle = (TextView) rowView.findViewById(R.id.item);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
TextView extratxt = (TextView) rowView.findViewById(R.id.textView1);
Button button =(Button) rowView.findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Do your Work
Launch the Required Intent
}
});
txtTitle.setText(itemname[position]);
imageView.setImageResource(imgid[position]);
extratxt.setText("Description of "+itemname[position]);
return rowView;
};
有没有人知道如何让它们并行工作?