SimpleAdapter Null Pointer Exception
<p>I'm try to use a SimpleAdapter to show some data,but when I call setAdapter() method, the program will throw Null Pointer Exception.</p>

<p>Here is my code:</p>

<p>b2clistview.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
 &lt;LinearLayout android:id="@+id/b2cLinearLayoutListView" android:background="#FFFFFF"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
         xmlns:android="http://schemas.android.com/apk/res/android"&gt;

       &lt;ListView  
        android:id="@+id/MarketListview"  
        android:divider="#4C2626"  
        android:dividerHeight="1dip"
        android:layout_width="fill_parent"  
        android:layout_height="fill_parent"  
        android:background="#FEFEFE"
        android:cacheColorHint="#FEFEFE" /&gt; 

 &lt;/LinearLayout&gt;
</code></pre>

<p>b2citem.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    &gt;  
      &lt;ImageView 
        android:id="@+id/b2cImage"
        android:layout_width="wrap_content"
        android:layout_height="50dip"
        android:layout_marginTop="20dp" 
        android:layout_alignParentLeft="true"
       /&gt;
    &lt;TextView
        android:id="@+id/price"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="#FF0000"    
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
       /&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>Activity:
This is the Activity,and the exception is in getResultBySubject()</p>

<pre><code>public class SuccessActivity extends Activity  implements Serializable {
    private static final long serialVersionUID = 1154263263314742973L;
    private static String url = "http://api.douban.com/book/subject/isbn/";
    private static String bijiaUrl="";
    BookInfo bookinfo;
    String ISBN = "";
    Bitmap bimage = null;
    List&lt;Map&lt;String, Object&gt;&gt; priceList;
    private ProgressDialog dialog; 
    private boolean isLoadFinish=false;
    public ListView b2cListView=null;
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.success);


        dialog = ProgressDialog.show(this, null, "please wait...", true, false); 


        final TextView bookName=(TextView)findViewById(R.id.bookNameTextview);
        final TextView authorName=(TextView)findViewById(R.id.authorTextview);
        final TextView ISBNview =(TextView)findViewById(R.id.ISBNTextview);
        final ImageView bookImage =(ImageView)findViewById(R.id.BookImage);
    final Button addToShelf =(Button)findViewById(R.id.addToShelf);
    final TextView summary=(TextView)findViewById(R.id.Summary);

    b2cListView=(ListView)findViewById(R.id.MarketListview);

    new Thread(new Runnable() {
        @Override
        public void run() {
            bookinfo = getResultByIsbn(ISBN);
            bimage = getBitmapFromURL(bookinfo.getUrl());


            getResultBySubject();



        runOnUiThread(new Runnable() {
            @Override
            public void run() {
            // Update UI
            if(isLoadFinish){
                dialog.dismiss();
                bookName.setText(bookinfo.getName());
                authorName.setText(bookinfo.getAuthor());
                ISBNview.setText(bookinfo.getISBN());
                bookImage.setImageBitmap(bimage);   
                summary.setText(bookinfo.getSummary());
            }
            }
        });

        }
    }).start();


    }


    private void getResultBySubject() {

        HttpClient client = new DefaultHttpClient();
        HttpGet get = new HttpGet( "http://"+bijiaUrl.substring(11)+"/buylinks?sortby=price");
        System.out.println("http://"+bijiaUrl.substring(11)+"/buylinks?sortby=price");
        HttpResponse response;

        response = client.execute(get);


        BufferedReader br=new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
        StringBuffer sb=new StringBuffer();
        String line="";
        while((line=br.readLine())!=null){
            sb.append(line);
        }
        //System.out.println(sb.toString());
        priceList =new ArrayList&lt;Map&lt;String, Object&gt;&gt;();

        String regex = "(**)(.*?)&lt;/a&gt;(.*?) href=\"(.*?)\"&gt;(.*?)&lt;/a&gt;";  
        Pattern p = Pattern.compile(regex);  
        Matcher m = p.matcher(sb.toString());  
        String val = null;  
        while (m.find()){  
          val = m.group();          
            Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
            map.put("PIC", R.drawable.joyo);                
            map.put("Price", m.group(5));
            map.put("MarketLink",m.group(4));            
            priceList.add(map);

        }  

    SimpleAdapter adapter = new SimpleAdapter(this,
        (List&lt;Map&lt;String, Object&gt;&gt;) priceList, R.layout.b2citem,
        new String[] { "PIC", "Price" }, new int[] {R.id.b2cImage, R.id.price });

        **//null pointer**
    b2cListView.setAdapter(adapter);


        }


    }



}
</code></pre>
