Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java XML解析器中此错误的原因是什么?_Java_Android_Xml_Xml Parsing - Fatal编程技术网

Java XML解析器中此错误的原因是什么?

Java XML解析器中此错误的原因是什么?,java,android,xml,xml-parsing,Java,Android,Xml,Xml Parsing,我通常可以处理出现在logcat上的错误,但是这个logcat错误让我觉得非常离奇,这个错误导致我的应用程序崩溃,onPreExecute方法被初始化,列表显示为加载,但是列表从未显示并崩溃。我已经在一个异步任务中包含了很多代码。感谢您抽出时间,我对Android编程非常陌生: 11-30 11:48:56.126: E/AndroidRuntime(1045): FATAL EXCEPTION: main 11-30 11:48:56.126: E/AndroidRuntime(1045):

我通常可以处理出现在logcat上的错误,但是这个logcat错误让我觉得非常离奇,这个错误导致我的应用程序崩溃,onPreExecute方法被初始化,列表显示为加载,但是列表从未显示并崩溃。我已经在一个异步任务中包含了很多代码。感谢您抽出时间,我对Android编程非常陌生:

11-30 11:48:56.126: E/AndroidRuntime(1045): FATAL EXCEPTION: main
11-30 11:48:56.126: E/AndroidRuntime(1045): Process: com.example.clinicbooker, PID: 1045
11-30 11:48:56.126: E/AndroidRuntime(1045): java.lang.NullPointerException
11-30 11:48:56.126: E/AndroidRuntime(1045):     at com.example.clinicbooker.LazyAdapter.getView(LazyAdapter.java:54)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.AbsListView.obtainView(AbsListView.java:2263)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.ListView.measureHeightOfChildren(ListView.java:1263)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.ListView.onMeasure(ListView.java:1175)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.View.measure(View.java:16458)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.View.measure(View.java:16458)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.View.measure(View.java:16458)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.View.measure(View.java:16458)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2289)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.View.measure(View.java:16458)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1914)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1111)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1293)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5582)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.Choreographer.doCallbacks(Choreographer.java:562)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.Choreographer.doFrame(Choreographer.java:532)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.os.Handler.handleCallback(Handler.java:733)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.os.Handler.dispatchMessage(Handler.java:95)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.os.Looper.loop(Looper.java:137)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at android.app.ActivityThread.main(ActivityThread.java:4998)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at java.lang.reflect.Method.invokeNative(Native Method)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at java.lang.reflect.Method.invoke(Method.java:515)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
11-30 11:48:56.126: E/AndroidRuntime(1045):     at dalvik.system.NativeStart.main(Native Method)
更具体地说,这个logcat指向我的适配器类第54行的一个错误:那就是TextView id=(TextView)vi.findViewById(R.id.id)

适配器类,如下所示:

public class LazyAdapter extends BaseAdapter {

    Context context;
    HashMap<String, String> resultp = new HashMap<String, String>();
    private ArrayList<HashMap<String, String>> data;
    private static LayoutInflater inflater = null;
    public ImageLoader imageLoader;

    public LazyAdapter(Context contextActivity , ArrayList<HashMap<String, String>> d) {
       this.context=contextActivity;
        data=d;
        imageLoader=new ImageLoader(context);
    }

    public int getCount() {
        return data.size();
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(final int position, View convertView, ViewGroup parent) {   
        View vi=convertView;

        inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View itemView=inflater.inflate(R.layout.book_list_row,parent,false);

        resultp=data.get(position);

        TextView id=(TextView)vi.findViewById(R.id.id); //NPE ERROR POINTS HERE
        TextView title = (TextView)vi.findViewById(R.id.menu_name); 
        TextView description = (TextView)vi.findViewById(R.id.address); 
        TextView bookingDate = (TextView)vi.findViewById(R.id.book_date); 
        TextView bookingTime = (TextView)vi.findViewById(R.id.book_time);
        ImageView thumb_image=(ImageView)vi.findViewById(R.id.list_image); 


        // Setting all values in listview
        id.setText(resultp.get(BookScreen.KEY_ID)); 
        title.setText(resultp.get(BookScreen.KEY_TITLE));
        description.setText(resultp.get(BookScreen.KEY_ADDRESS));
        bookingDate.setText(resultp.get(BookScreen.KEY_DATE));
        bookingTime.setText(resultp.get(BookScreen.KEY_TIME));
        imageLoader.DisplayImage(resultp.get(BookScreen.KEY_THUMB_URL), thumb_image);

        itemView.setOnClickListener(new OnClickListener(){

            public void onClick(View arg0) {
                resultp=data.get(position);
                Intent intent=new Intent(context,SingleItemView.class);
                intent.putExtra("id",resultp.get(BookScreen.KEY_ID));
                intent.putExtra("title",resultp.get(BookScreen.KEY_TITLE));
                intent.putExtra("address",resultp.get(BookScreen.KEY_ADDRESS));
                intent.putExtra("date",resultp.get(BookScreen.KEY_DATE));
                intent.putExtra("time",resultp.get(BookScreen.KEY_TIME));
                intent.putExtra("thumbnail",resultp.get(BookScreen.KEY_THUMB_URL));
                context.startActivity(intent);
            }
        });
        return vi;
    }
}
公共类LazyAdapter扩展了BaseAdapter{
语境;
HashMap resultp=新的HashMap();
私有数组列表数据;
专用静态充气机=空;
公共图像加载器;
公共LazyAdapter(上下文上下文活动,ArrayList d){
this.context=contextActivity;
数据=d;
imageLoader=新的imageLoader(上下文);
}
public int getCount(){
返回data.size();
}
公共对象getItem(int位置){
返回null;
}
公共长getItemId(int位置){
返回0;
}
公共视图getView(最终int位置、视图转换视图、视图组父级){
视图vi=转换视图;
充气器=(LayoutFlater)context.getSystemService(context.LAYOUT\u充气器\u服务);
视图项视图=充气机。充气(R.layout.book\u list\u行,父项,false);
resultp=data.get(位置);
TextView id=(TextView)vi.findviewbyd(R.id.id);//此处的NPE错误点
TextView title=(TextView)vi.findViewById(R.id.menu\u name);
TextView description=(TextView)vi.findViewById(R.id.address);
TextView bookingDate=(TextView)vi.findViewById(R.id.book\u日期);
TextView bookingTime=(TextView)vi.findViewById(R.id.book\u时间);
ImageView thumb\u image=(ImageView)vi.findViewById(R.id.list\u image);
//在listview中设置所有值
id.setText(resultp.get(BookScreen.KEY_id));
title.setText(resultp.get(BookScreen.KEY_title));
description.setText(resultp.get(BookScreen.KEY_ADDRESS));
bookingDate.setText(resultp.get(BookScreen.KEY_DATE));
bookingTime.setText(resultp.get(BookScreen.KEY_TIME));
imageLoader.DisplayImage(resultp.get(BookScreen.KEY\u THUMB\u URL)、THUMB\u image);
setOnClickListener(新的OnClickListener(){
公共void onClick(视图arg0){
resultp=data.get(位置);
意向意向=新意向(上下文,SingleItemView.class);
intent.putExtra(“id”,resultp.get(BookScreen.KEY_id));
intent.putExtra(“title”,resultp.get(BookScreen.KEY_title));
intent.putExtra(“地址”,resultp.get(BookScreen.KEY_地址));
intent.putExtra(“日期”,resultp.get(BookScreen.KEY_date));
intent.putExtra(“时间”,resultp.get(BookScreen.KEY_time));
intent.putExtra(“缩略图”,resultp.get(BookScreen.KEY\u THUMB\u URL));
背景。开始触觉(意图);
}
});
返回vi;
}
}
这些错误是什么意思:AbsListView、ListView、LinearLayout、FrameLayout。我试图解析的xml文件是否与我的代码不兼容

我的主要活动:

public class BookScreen extends Activity {

    //array
    ArrayList<HashMap<String, String>> songsList;
    ProgressDialog mProgressDialog;
    // All static variables
    static final String URL = "https://dl.dropboxusercontent.com/u/42241589/test.xml";
    // XML node keys
    static final String KEY_CLINIC = "clinic"; // parent node
    static final String KEY_ID = "id";
    static final String KEY_TITLE = "title";
    static final String KEY_DATE = "date";
    static final String KEY_TIME = "time";
    static final String KEY_ADDRESS = "address";
    static final String KEY_THUMB_URL = "thumbnail";
    ListView list;
    LazyAdapter adapter;

    @SuppressLint("NewApi")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.book_main);
        new DownloadXML().execute();
    }

    private class DownloadXML extends AsyncTask<Void, Void, Void> {

        protected void onPreExecute() {
            super.onPreExecute();
            mProgressDialog = new ProgressDialog(BookScreen.this);
            mProgressDialog.setTitle("List is loading");
            mProgressDialog.setMessage("Loading...");
            mProgressDialog.setIndeterminate(false);
            mProgressDialog.show();
        }

        protected Void doInBackground(Void... params) {
            songsList = new ArrayList<HashMap<String, String>>();
            XMLParser parser = new XMLParser();
            String xml = parser.getXmlFromUrl(URL); // getting XML from URL
            Document doc = parser.getDomElement(xml); // getting DOM element
            try {
                NodeList nl = doc.getElementsByTagName(KEY_CLINIC); //define parent node
                // looping through all song nodes &lt;song&gt;
                for (int i = 0; i < nl.getLength(); i++) {
                    // creating new HashMap
                    HashMap<String, String> map = new HashMap<String, String>();
                    Element e = (Element) nl.item(i);
                    // adding each child node to HashMap key =&gt; value
                    map.put(KEY_ID, parser.getValue(e, KEY_ID));
                    map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));
                    map.put(KEY_DATE, parser.getValue(e, KEY_DATE));
                    map.put(KEY_TIME, parser.getValue(e, KEY_TIME));
                    map.put(KEY_ADDRESS, parser.getValue(e, KEY_ADDRESS));
                    map.put(KEY_THUMB_URL, parser.getValue(e, KEY_THUMB_URL));
                    // adding HashList to ArrayList
                    songsList.add(map);
                }
            } catch (Exception e) {
                Log.e("Error", e.getMessage());
                e.printStackTrace();
            }
            return null;
        }

        protected void onPostExecute(Void args) {
                list=(ListView)findViewById(R.id.list);

            // Getting adapter by passing xml data ArrayList
            adapter = new LazyAdapter(BookScreen.this, songsList);
            list.setAdapter(adapter);
            //Close dialog
            mProgressDialog.dismiss();
        }
    }
}
public class BookScreen扩展活动{
//排列
ArrayList songsList;
进程对话框;
//所有静态变量
静态最终字符串URL=”https://dl.dropboxusercontent.com/u/42241589/test.xml";
//XML节点密钥
静态最终字符串KEY\u CLINIC=“CLINIC”//父节点
静态最终字符串键\u ID=“ID”;
静态最终字符串键\u TITLE=“TITLE”;
静态最终字符串键\u DATE=“DATE”;
静态最终字符串键\u TIME=“TIME”;
静态最终字符串键\u ADDRESS=“ADDRESS”;
静态最终字符串键\u THUMB\u URL=“缩略图”;
列表视图列表;
懒散适配器;
@SuppressLint(“新API”)
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.book_main);
新下载的xml().execute();
}
私有类下载XML扩展异步任务{
受保护的void onPreExecute(){
super.onPreExecute();
mProgressDialog=新建进度对话框(BookScreen.this);
setTitle(“列表正在加载”);
设置消息(“加载…”);
mProgressDialog.setUndeterminate(false);
mProgressDialog.show();
}
受保护的Void doInBackground(Void…参数){
songsList=newarraylist();
XMLParser=新的XMLParser();
字符串xml=parser.getXmlFromUrl(URL);//从URL获取xml
Document doc=parser.getDomeElement(xml);//获取DOM元素
试一试{
NodeList nl=doc.getElementsByTagName(KEY_CLINIC);//定义父节点
//通过所有歌曲节点循环播放歌曲
对于(int i=0;i<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <ListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:divider="#b5b5b5"
        android:dividerHeight="1dp"
        android:listSelector="@drawable/list_selector" />

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="5dip" >

    <!-- ListRow Left sied Thumbnail image -->

    <LinearLayout
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="5dip"
        android:padding="3dip" >

        <ImageView
            android:id="@+id/list_image"
            android:layout_width="50dip"
            android:layout_height="50dip" 
            />
    </LinearLayout>

    <!-- Menu name -->

    <TextView
        android:id="@+id/menu_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="@string/book_name"
        android:textColor="#040404"
        android:textSize="15sp"
        android:textStyle="bold"
        android:typeface="sans" />

    <!-- Description -->

    <TextView
        android:id="@+id/address"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/thumbnail"
        android:layout_below="@id/menu_name"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="@string/book_address"
        android:textColor="#343434"
        android:textSize="10sp"
        tools:ignore="SmallSp" />

    <!-- Price -->

    <TextView
        android:id="@+id/book_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@id/menu_name"
        android:layout_marginRight="5dip"
        android:gravity="right"
        android:text="@string/book_date"
        android:textColor="#10bcc9"
        android:textSize="10sp"
        android:textStyle="bold"
        tools:ignore="SmallSp" />

    <TextView
        android:id="@+id/book_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/book_date"
        android:layout_centerVertical="true"
        android:gravity="right"
        android:text="@string/book_time"
        android:textColor="#10bcc9"
        android:textSize="10sp"
        android:textStyle="bold"
        tools:ignore="SmallSp" />

    <TextView 
        android:id="@+id/id"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
       > </TextView>

</RelativeLayout>
public class ImageLoader {

    MemoryCache memoryCache=new MemoryCache();
    FileCache fileCache;
    private Map<ImageView, String> imageViews=Collections.synchronizedMap(new WeakHashMap<ImageView, String>());
    ExecutorService executorService;

    public ImageLoader(Context context){
        fileCache=new FileCache(context);
        executorService=Executors.newFixedThreadPool(5);
    }

    final int stub_id = R.drawable.no_image;
    public void DisplayImage(String url, ImageView imageView)
    {
        imageViews.put(imageView, url);
        Bitmap bitmap=memoryCache.get(url);
        if(bitmap!=null)
            imageView.setImageBitmap(bitmap);
        else
        {
            queuePhoto(url, imageView);
            imageView.setImageResource(stub_id);
        }
    }

    private void queuePhoto(String url, ImageView imageView)
    {
        PhotoToLoad p=new PhotoToLoad(url, imageView);
        executorService.submit(new PhotosLoader(p));
    }

    private Bitmap getBitmap(String url)
    {
        File f=fileCache.getFile(url);

        //from SD cache
        Bitmap b = decodeFile(f);
        if(b!=null)
            return b;

        //from web
        try {
            Bitmap bitmap=null;
            URL imageUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
            conn.setConnectTimeout(30000);
            conn.setReadTimeout(30000);
            conn.setInstanceFollowRedirects(true);
            InputStream is=conn.getInputStream();
            OutputStream os = new FileOutputStream(f);
            Utils.CopyStream(is, os);
            os.close();
            bitmap = decodeFile(f);
            return bitmap;
        } catch (Exception ex){
           ex.printStackTrace();
           return null;
        }
    }

    //decodes image and scales it to reduce memory consumption
    private Bitmap decodeFile(File f){
        try {
            //decode image size
            BitmapFactory.Options o = new BitmapFactory.Options();
            o.inJustDecodeBounds = true;
            BitmapFactory.decodeStream(new FileInputStream(f),null,o);

            //Find the correct scale value. It should be the power of 2.
            final int REQUIRED_SIZE=70;
            int width_tmp=o.outWidth, height_tmp=o.outHeight;
            int scale=1;
            while(true){
                if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE)
                    break;
                width_tmp/=2;
                height_tmp/=2;
                scale*=2;
            }

            //decode with inSampleSize
            BitmapFactory.Options o2 = new BitmapFactory.Options();
            o2.inSampleSize=scale;
            return BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
        } catch (FileNotFoundException e) {}
        return null;
    }

    //Task for the queue
    private class PhotoToLoad
    {
        public String url;
        public ImageView imageView;
        public PhotoToLoad(String u, ImageView i){
            url=u;
            imageView=i;
        }
    }

    class PhotosLoader implements Runnable {
        PhotoToLoad photoToLoad;
        PhotosLoader(PhotoToLoad photoToLoad){
            this.photoToLoad=photoToLoad;
        }

        @Override
        public void run() {
            if(imageViewReused(photoToLoad))
                return;
            Bitmap bmp=getBitmap(photoToLoad.url);
            memoryCache.put(photoToLoad.url, bmp);
            if(imageViewReused(photoToLoad))
                return;
            BitmapDisplayer bd=new BitmapDisplayer(bmp, photoToLoad);
            Activity a=(Activity)photoToLoad.imageView.getContext();
            a.runOnUiThread(bd);
        }
    }

    boolean imageViewReused(PhotoToLoad photoToLoad){
        String tag=imageViews.get(photoToLoad.imageView);
        if(tag==null || !tag.equals(photoToLoad.url))
            return true;
        return false;
    }

    //Used to display bitmap in the UI thread
    class BitmapDisplayer implements Runnable
    {
        Bitmap bitmap;
        PhotoToLoad photoToLoad;
        public BitmapDisplayer(Bitmap b, PhotoToLoad p){bitmap=b;photoToLoad=p;}
        public void run()
        {
            if(imageViewReused(photoToLoad))
                return;
            if(bitmap!=null)
                photoToLoad.imageView.setImageBitmap(bitmap);
            else
                photoToLoad.imageView.setImageResource(stub_id);
        }
    }

    public void clearCache() {
        memoryCache.clear();
        fileCache.clear();
    }

}
convertView = inflater.inflate(R.layout.book_list_row,parent,false);
TextView id=(TextView) convertView.findViewById(R.id.id);
//similarly for other views
static class ViewHolder
{

       TextView id,title,description,bookingDate,bookingTime;   
       ImageView thumb_image;

}
public View getView(int position, View convertView, ViewGroup parent) { 
             ViewHolder holder; 

   if (convertView == null) {
    convertView = mInflater.inflate(R.layout.book_list_row, parent, false);
    holder = new ViewHolder(); 
    holder.id=(TextView)convertView.findViewById(R.id.id); 
    holder.title = (TextView)convertView.findViewById(R.id.menu_name); 
    holder.description = (TextView)convertView.findViewById(R.id.address); 
    holder.bookingDate = (TextView)convertView.findViewById(R.id.book_date); 
    holder.bookingTime = (TextView)convertView.findViewById(R.id.book_time);
    holder.thumb_image=(ImageView)convertView.findViewById(R.id.list_image);    
    convertView.setTag(holder); 
    } else { 
   holder = (ViewHolder) convertView.getTag(); 
   }
   holder.id.setText(resultp.get(BookScreen.KEY_ID)); 
   holder.title.setText(resultp.get(BookScreen.KEY_TITLE));
   holder.description.setText(resultp.get(BookScreen.KEY_ADDRESS));
   holder.bookingDate.setText(resultp.get(BookScreen.KEY_DATE));
   holder. bookingTime.setText(resultp.get(BookScreen.KEY_TIME));
   hodler.imageLoader.DisplayImage(resultp.get(BookScreen.KEY_THUMB_URL), thumb_image);

   convertView.setOnClickListener(new OnClickListener(){

        public void onClick(View arg0) {
            resultp=data.get(position);
            Intent intent=new Intent(context,SingleItemView.class);
            intent.putExtra("id",resultp.get(BookScreen.KEY_ID));
            intent.putExtra("title",resultp.get(BookScreen.KEY_TITLE));
            intent.putExtra("address",resultp.get(BookScreen.KEY_ADDRESS));
            intent.putExtra("date",resultp.get(BookScreen.KEY_DATE));
            intent.putExtra("time",resultp.get(BookScreen.KEY_TIME));
            intent.putExtra("thumbnail",resultp.get(BookScreen.KEY_THUMB_URL));
            context.startActivity(intent);
       }       
     });
   return convertView; 
}