Syntax error, insert "}" to complete Statement. issue
<p>This is one of my app activities. I really try to complete statement successfully but I cant. It raise red line error under <code>vi.setTag(holder);}</code> exactly under <code>}</code> </p>

<p>This is piece of code  which has the error:</p>

<pre><code>View vi=convertView;
final ViewHolder holder;
if(convertView==null){
    vi = inflater.inflate(R.layout.gallery_items, null);
    holder=new ViewHolder();
    holder.text=(TextView)vi.findViewById(R.id.textView1);
    holder.image=(ImageView)vi.findViewById(R.id.image);
    holder.button=(Button)vi.findViewById(R.id.button_save);

    bm = BitmapFactory.decodeResource( mContext.getResources(), images[itemPos]);
    holder.image.setImageBitmap(bm);

    holder.button.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {

            //Create Directory to store images in SDCard
            String root = Environment.getExternalStorageDirectory().toString();
            File myDir = new File(root + "/saved_images");
            if(!myDir.exists()){
                myDir.mkdirs();
            }
            // You have to get next image here from the resource here
            bm = BitmapFactory.decodeResource( mContext.getResources(), images[i]);
            // value for itemPos should be given here.

            // Get Last Saved Number
            SharedPreferences savedNumber = getSharedPreferences(PREFS_NAME, 0);
            int lastSavedNumber = savedNumber.getInt("lastsavednumber",0);
            lastSavedNumber++;
            String fname = "Image-"+lastSavedNumber+".png";

            File file = new File (myDir, fname);
            if (file.exists ()) {file.delete (); }
            try {
                FileOutputStream out = new FileOutputStream(file);
                bm.compress(Bitmap.CompressFormat.JPEG, 90, out);//Your Bitmap from the resouce
                out.flush();
                out.close();
            Toast.makeText(mContext, "Saved", Toast.LENGTH_LONG).show();}
            catch (Exception e) {
            e.printStackTrace(); }


            //To Store the last Number
            SharedPreferences saveNumber = getApplicationContext().getSharedPreferences
            (PREFS_NAME, 0);
            SharedPreferences.Editor editorset = saveNumber.edit();
            editorset.putInt("lastsavednumber",lastSavedNumber);
            editorset.commit();
        vi.setTag(holder);  } //====&amp;gt; here where red line error appear

        else holder=(ViewHolder)vi.getTag();
        holder.text.setText(name[itemPos]);

        final int stub_id=images[itemPos];
        holder.image.setImageResource(stub_id);
    return vi; }
</code></pre>

<p>Any help will be appreciated, thanks</p>
