setOnItemClickListener not working when i use custom adapter in android
===

I m using lazYadapter for listview and  face problem that when i try to go from on activity to another on click on list then it's not working and throws exception.pls help  me.   
I refer link:
http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/ 

Code:
    
    package com.app.Android;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;
    
    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.util.Log;
    import android.view.View;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.ListView;
    import android.widget.RelativeLayout;
    import android.widget.TextView;
    import android.widget.Toast;
    
    public class Listing extends Activity{
    	private static ProgressDialog dialog;
    	private static Handler handler;
    	private Thread thread;
    	private static TextView errorid;
    	private static ListView list;
    	private static JSONArray propobj;
    	private static Jsonparse parse;
    	private static ArrayList<HashMap<String,String>> mylist;
    	private static HashMap<String, String> map;
    	private static int flag = 0;
    	String totalagents;
    	String indexarr = "";
    
        static final String KEY_ID = "id";
        static final String KEY_TITLE = "title";
        static final String KEY_Name= "name";
        static final String KEY_Dphone = "phone";
        static final String KEY_Mphone = "mobile";
        static final String KEY_Email = "email";
        static final String KEY_THUMB_URL = "photo";
    	public void onCreate(Bundle savedInstanceState)
    	{
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.listdisplay);
    		parse = new Jsonparse();
    		handler = new Handler();
            mylist = new ArrayList<HashMap<String, String>>();
            errorid = (TextView) findViewById(R.id.error);
            list = (ListView) findViewById(R.id.list);
    		dialog = ProgressDialog.show(this,Default.theme,"Loading..");
            thread = new MyThread();
            thread.start();
    	}	
    	public class MyThread extends Thread {
    		@Override
    		public void run() {
    				try 
    				{
    					new Thread().sleep(5000);		
    					try
    					{
    						String pageno = getIntent().getStringExtra("agent_pageno");
    						String agt_name = getIntent().getStringExtra("agent_name");
    						String agt_city = getIntent().getStringExtra("agent_city");
    						if(agt_city.equals("No Preference"))
    							agt_city = "";
    						String agt_office = getIntent().getStringExtra("agent_office");
    						String agt_lang = getIntent().getStringExtra("agent_lang");
    						propobj = parse.getListfromURL(Default.AppUrl+"/mobile/android_mlsSearch.php?value=agentlist&page="+pageno+"&agentname="+agt_name+"&language="+agt_lang+"&office="+agt_office+"&city="+agt_city);
    				        if((propobj.toString()).indexOf("error")!= -1)
    				        {
    				        	flag = 1; 
    				        	handler.post(new MyRunnable());
    				        }
    				        else
    				        {	
    				        	JSONObject e = null;
    				        	for(int i=0;i<propobj.length();i++)
    				        	{					        		
    							    map = new HashMap<String, String>();	
    								e = propobj.getJSONObject(i);
    								map.put(KEY_ID, e.getString("AgentId"));
    								map.put(KEY_THUMB_URL,Default.AppUrl+"/vendor/thumb/thumb.php?x=100&y=150&src="+e.getString("AgentPhoto"));
    								map.put(KEY_Name, e.getString("AgentFullName"));
    								map.put(KEY_TITLE,e.getString("AgentTitle"));
    					        	map.put(KEY_Dphone,"Direct Line : "+ e.getString("AgentDirectPhone"));
    					        	map.put(KEY_Mphone,"Mobile #: "+ e.getString("AgentMobile"));
    					        	map.put(KEY_Email,"Email : "+ e.getString("AgentEmail"));
    					        	mylist.add(map);			
    				        	}
    				        	totalagents = e.getString("totalAgents");  
    				        	handler.post(new MyRunnable());					      
    						}				        
    					 }catch(JSONException e)
    					 {
    			        	 Log.e("log_tag", "Error parsing data "+e.toString());
    			         }
    					 dialog.dismiss(); 					 
    				} 
    				catch (InterruptedException e) {
    					e.printStackTrace();
    				}
    		}
    	}
    	public class MyRunnable implements Runnable {
    		LazyAdapter adapter;
    		Intent getagtdetail;
    			public void run() {				
    				try
    				{
    					Log.i("run=>", "run");
    					if(flag == 1)
    					{
    						list.setVisibility(View.GONE);
    						errorid.setVisibility(View.VISIBLE);
    						errorid.setText("No Agent found.");
    					}
    					else
    					{
    						TextView show_agent = (TextView)findViewById(R.id.totalagent);						
    						show_agent.setText(totalagents+" agents found" );
    						RelativeLayout rel =(RelativeLayout)findViewById(R.id.relative);
    						rel.setVisibility(View.VISIBLE);					     
    						 
    						adapter=new LazyAdapter(Listing.this, mylist);
    						 
    						list.setAdapter(adapter);	
    						
    						list.setItemsCanFocus(false);
    
    		        		list.setTextFilterEnabled(true);	
    		        		
    		        		list.setOnItemClickListener(new OnItemClickListener() {
    		        		//@SuppressWarnings("unchecked")
    						@Override
    			            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    		        			Log.i("1=>", ""+position);
    		        			//Toast.makeText(getApplicationContext(), "You selected item #: " + position,Toast.LENGTH_SHORT).show();
    		        			Intent getagtdetail = new Intent(Listing.this,AgentDetail.class);
    		        			startActivity(getagtdetail);	
    			                
    			            	}
    		        		});	       				
    		        	}
    				}	
    	        	catch(Exception e)
    	        	{
    	        		Log.i("hello",e.toString());
    	        	}
    				dialog.dismiss();
    			}
    	}
    	public void backToHome(View v)
    	{
    		finish();
    	}
    }



