NullPointer cause in CustomListview
<p>I am developing an application in which i have Implement <code>CustomListview</code> with one icon, raitingbar,checkbox. now everything is display fine but when i have insert one button it getting me nullpointer error.i know that nullpointer error cause in situation of not initialize the control... but i have tried so far and not understand what is the proble over here....</p>

<p>i have take one viewHold for declare all Row item..</p>

<pre><code>package com.AppFavorits;

import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

class ViewHolder {

    public ImageView imgvFavrowiconappicon;
    public TextView txvxFavrowiconappname;
    public RatingBar ratingBar1;
    public CheckBox chkbxFavrowsel;
    public Button btnFavrowOpen;




  ViewHolder(View base) {
    this.ratingBar1=(RatingBar)base.findViewById(R.id.ratingBar1);
    this.ratingBar1.setFocusable(false);
    this.txvxFavrowiconappname=(TextView)base.findViewById(R.id.txvxFavrowiconappname);
    this.imgvFavrowiconappicon=(ImageView)base.findViewById(R.id.imgvFavrowiconappicon);
    this.chkbxFavrowsel = (CheckBox)base.findViewById(R.id.chkbxFavrowsel);
    this.btnFavrowOpen= (Button)base.findViewWithTag(R.id.btnFavrowOpen); 
    this.chkbxFavrowsel.setFocusable(false);

  }
}
</code></pre>

<p><strong>CustomAdapter</strong></p>

<pre><code>class RatingAdapter extends ArrayAdapter&lt;RowModel&gt; implements OnClickListener {
        private ArrayList&lt;Model&gt; mlist;
        boolean[] checkBoxState;

        RatingAdapter(ArrayList&lt;RowModel&gt; list, ArrayList&lt;Model&gt; mlist) {
            super(Favorites.this, R.layout.rowfavorites,
                    R.id.txvxFavrowiconappname, list);
            checkBoxState = new boolean[list.size()];
            this.mlist = mlist;
        }

        public View getView(final int position, View convertView,
                ViewGroup parent) {
            View row = super.getView(position, convertView, parent);

            holder = (ViewHolder) row.getTag();
            if (convertView == null) {
                holder = new ViewHolder(row);
                row.setTag(holder);


            } else {
                row = convertView;
                ((ViewHolder) row.getTag()).chkbxFavrowsel.setTag(mlist
                        .get(position));
            }

            RatingBar.OnRatingBarChangeListener l = new RatingBar.OnRatingBarChangeListener() {
                public void onRatingChanged(RatingBar ratingBar, float rating,
                        boolean fromTouch) {
                    Integer myPosition = (Integer) ratingBar.getTag();
                    RowModel model = getModel(myPosition);
                    model.rating = rating;
                    flFavRate[position] = rating;
                    // stored listitem rating in array
                    datasource.open();
                    datasource.UpdateRating(String.valueOf(rating), String.valueOf(position+1));
                    datasource.close();


                }
            };
            holder.ratingBar1.setOnRatingBarChangeListener(l);


             holder.chkbxFavrowsel
                    .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                        @Override
                        public void onCheckedChanged(CompoundButton buttonView,
                                boolean isChecked) {
                            Model element = (Model) holder.chkbxFavrowsel
                                    .getTag();
                            element.setSelected(buttonView.isChecked());
                            bSelected[position] = isChecked;
                            element.setsizeInc(sizeincrement);
                            // if (holder.chkbxFavrowsel.isChecked() ==
                            // isChecked) {
                            boolean bAlreadyfav = false;
                            String prefixlink = "https://play.google.com/store/apps/details?id=";
                            ShrdDatasource.open();
                            ArrayList&lt;Comment&gt; alDSPackagenm = ShrdDatasource.getAllPackage();
                            ArrayList&lt;Comment&gt; alDSRating = ShrdDatasource.getAllRating();
                            ArrayList&lt;Comment&gt; alDSID = ShrdDatasource.getID();
                            Log.i(TAG, "First Package cmp"+  alDSPackagenm);
                            ShrdDatasource.close();
                            int i = 0 ;
                            if (alDSPackagenm != null) {
                                for (i = 0; i &lt; alDSPackagenm.size(); i++) {
                                    if(alDSPackagenm.get(i).toString().equalsIgnoreCase(prefixlink + alPackagenm.get(position).toString() + "1x2optrue") || alDSPackagenm.get(i).toString().equalsIgnoreCase(prefixlink + alPackagenm.get(position).toString() + "1x2opfalse"))
                                    {
                                        bAlreadyfav = true;
                                        break;
                                    }
                                }

                            }
                            GolbPosition = position;
                            if (bAlreadyfav == true) {
                                Log.i(TAG, "Share positionis "+i);
                                Log.i(TAG, "Current positionis "+position);
                                Log.i(TAG,"ShrdDatasource Rating" + alDSRating.get(i).toString());
                                Log.i(TAG,"Favorite Rating" + String.valueOf(flFavRate[GolbPosition]));


                                if(alDSRating.get(i).toString().equalsIgnoreCase(String.valueOf(flFavRate[GolbPosition])))
                                {
                                    Toast.makeText(getBaseContext(), " App already in Share list ",
                                        Toast.LENGTH_LONG).show();
                                }
                                else
                                {
                                    //alid
                                    /*GolbPosition = position;
                                    new GETFavTask().execute();*/

                                    //UpdateRating
                                    ShrdDatasource.open();
                                    ShrdDatasource.UpdateRating(String.valueOf(flFavRate[GolbPosition]), alDSID.get(i).toString());
                                    ShrdDatasource.close();


                                    //Update Query fire
                                }
                            } else {
                                //Log.i(TAG, "First Package cmp"+ alDSPackagenm.get(position).toString());
                                Log.i(TAG, "Second Package cmp"+  alPackagenm.get(position).toString());
                                GolbPosition = position;
                                new GETFavTask().execute();

                                // add item in Database when user get select
                            }

                        }
                    });
                RowModel model = getModel(position);
                ViewHolder holder = (ViewHolder) row.getTag();
                holder.ratingBar1.setTag(new Integer(position));
                //holder.btnFavrowOpen.setTag(mlist.get(position));
                holder.ratingBar1.setRating(model.rating);
                holder.imgvFavrowiconappicon.setImageDrawable(drblAlIcon[position]);
                holder.txvxFavrowiconappname.setText(alAppName.get(position)
                    .toString());
                holder.chkbxFavrowsel.setChecked(mlist.get(position).isSelected());
                holder.chkbxFavrowsel.setTag(mlist.get(position));

                holder.btnFavrowOpen.setOnClickListener(new View.OnClickListener() {
                     public void onClick(View v) {
                        // OpenApp(alPackagenm.get(position).toString());
                     }
                 });
                try
                {
                if (alAppRating.get(position) == null | alAppRating.get(position).toString().equalsIgnoreCase("null")) {
                        holder.ratingBar1.setRating(0.0f);
                } else {
                    holder.ratingBar1.setRating(Float.parseFloat(alAppRating
                            .get(position).toString()));
                }
                }catch (Exception e) {
                    e.printStackTrace();
                }
                //holder.ratingBar1.setRating(Float.parseFloat(alAppRating.get(position).toString()));






            return (row);
        }
</code></pre>

<p>Here you can see the button <code>holder.btnFavrowOpen</code> with onclicklistner i got null pointer at that line very much tied what happen here.... if i am remove button code in adapter it getting work fine...but when i write button code again it getting Error of null pointer</p>
