after picking image from gallery and set to imageview in between that black screen comes for 4-5 sec
<p>After picking image from gallery and set to imageview in between that black screen comes for 4-5 sec, m able to set image to imageview but how to handle that black screen.</p>

<p>To open Gallery code is below</p>

<pre><code>  Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent,
                        "Select Picture"), 1);
</code></pre>

<p>I am storing that image path in arraylist and then reloading GalleryGridImageAddAdapter like below -</p>

<pre><code> protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        switch(requestCode) {


            case 1:
                if(resultCode == RESULT_OK)
                {
                    Uri selectedImageUri = data.getData();

                    if(selectedImageUri !=null)
                    {

                       String selectedImagePath = getPath(getBaseContext(),selectedImageUri);
                       File sel = new File(selectedImagePath);
                        Bitmap bitmap = BitmapFactory.decodeFile(sel.getAbsolutePath());
                        alistImages.add(selectedImagePath);

                        GalleryGridImageAddAdapter adapter = new GalleryGridImageAddAdapter(GalleryMultipleImageAdd.this, R.layout.template_gallery_image, alistImages);
                        gridview.setAdapter(adapter);

                    }
                    else
                    {
                        Toast.makeText(getApplicationContext(), "Sorry not able to select image, Try again", Toast.LENGTH_LONG).show();

                    }
                }
                break;
        }
    }
</code></pre>

<p>-------------------GalleryGridImageAddAdapter.class-----------</p>

<pre><code>public class GalleryGridImageAddAdapter extends ArrayAdapter&lt;String&gt; {

    Context mContext;
    ArrayList&lt;String&gt; imgList ;

    public GalleryGridImageAddAdapter(Context context, int resource, ArrayList&lt;String&gt; alist) {
        super(context, resource, alist);
        mContext = context;
        imgList = alist;

    }

    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflator = ((android.app.Activity) mContext)
                .getLayoutInflater();
        View row = convertView;
        UserHolder holder = null;

        if (row == null) {
            row = inflator.inflate(R.layout.template_gallery_image, parent,
                    false);
            holder = new UserHolder();
            holder.image = (ImageView) row.findViewById(R.id.image);
            holder.tv_delete_image = (TextView) row.findViewById(R.id.tv_delete_image);
            row.setTag(holder);
        } else {
            holder = (UserHolder) row.getTag();
        }

        holder.tv_delete_image.setVisibility(View.GONE);

        holder.image.getLayoutParams().width = GalleryImagesActivity.imgWidth;
        holder.image.getLayoutParams().height = GalleryImagesActivity.imgHeight;

        File sel = new File(imgList.get(position));
        Bitmap bitmap = BitmapFactory.decodeFile(sel.getAbsolutePath());
        Bitmap resized = Bitmap.createScaledBitmap(bitmap,100,75, true);
        holder.image.setImageBitmap(resized);

        bitmap = null;
        resized = null;
        return row;
    }



    static class UserHolder {

        ImageView image;
        TextView tv_delete_image;
    }


}
</code></pre>