构造函数 ArrayAdapter 的点击问题

当我点击一个 button search 时,我想在 listview 中显示 image 和 text。但是在 setListAdapter(new MobileArrayAdapter(this, PNames,PImages));这里出现错误。有两个类。
当我显示 onformLoad,可以正常运行。现在我需要使用一个按钮来显示。如何实现?
其中的一个类:

    B_KZN.setOnClickListener(new View .OnClickListener() {

        @Override
            public void onClick(View Kv) {
    // TODO Auto-generated method stub

   JSONObject json = JSONfunctions.getJSONfromURL("http://10.0.2.2/php/p.php");

   try{

            JSONArray  earthquakes = json.getJSONArray("SKZN");

           for(int i=0;i<earthquakes.length();i++){                     

            JSONObject e = earthquakes.getJSONObject(i);    
            String BookName = e.getString("P_City");
        PNames.add(BookName);
    String BookImg = e.getString("Pname");
        PImages.add(BookImg);
    }       
        }catch(JSONException e){
         Log.e("log_tag", "Error parsing data "+e.toString());
    }                   
        setListAdapter(new MobileArrayAdapter(this, PNames,PImages));

第二个类:

public class MobileArrayAdapter extends ArrayAdapter<String> {
    private final Context context;
    private final String[] myBookNamelist = null;
    private ArrayList<String> MyP = new ArrayList<String>();
    private ArrayList<String> myPurl = new ArrayList<String>();

    public MobileArrayAdapter(Context context,ArrayList<String> Bname,ArrayList<String> BUrl) {
        super(context, R.layout.list_mobile, Bname);
        this.context = context;
        this.MyP = Bname;
        this.myPurl = BUrl;
    }

错误是:The constructor MobileArrayAdapter(new View.OnClickListener(){}, ArrayList<String>, ArrayList<String>) is undefined

setListAdapter(new MobileArrayAdapter(this, PNames,PImages))这里的this错了,需要一个context,你应该是 new MobileArrayAdapter(XXXActivity.this, PNames,PImages)

嗯 上面说的没错

你定义的构造方法是 public MobileArrayAdapter(Context context,ArrayList Bname,ArrayList BUrl) {}
而你传入的this 代表的是你自己new的View .OnClickListener()
正确做法是YourActivity.this
还有网络请求不要在主线程,最好异步执行
JSONObject json = JSONfunctions.getJSONfromURL("http://10.0.2.2/php/p.php");