Android AlertDialog force close
<p>I have used the code below in a different activity in the same app with no problems, but in this activity, I get a force close when clicking the image. The event handler fires, as I see the toast, if I don't call the popupImage(). In the debugger, I get a Class cast exception, but I'm not sure how to fix it.</p>

<pre><code>picture.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            // Show popup with full image of the clicked small img.
            Toast.makeText(getApplicationContext(), "debug CLICKED IMG",
                    Toast.LENGTH_LONG).show();
            popupImage(show);//fungerer stadig ikke
        }
    });
}
</code></pre>

<p>and </p>

<pre><code>private void popupImage(Show show) {
    Context context = getApplicationContext();
    // ImgHandler imageHandler = new ImgHandler();
    // Bitmap bitmapImage = imageHandler.getImg(show.getShowId()) ;
    AlertDialog.Builder imageDialog = new AlertDialog.Builder(context);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);

    View layout = inflater.inflate(R.layout.custom_fullimage_dialog, (ViewGroup) ((Activity) context).findViewById(R.id.layout_root));
    ImageView image = (ImageView) layout.findViewById(R.id.fullimage);
    image.setImageBitmap(pic);
    imageDialog.setView(layout);
    imageDialog.setPositiveButton(getString(R.string.Close),
            new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
    imageDialog.create();
    imageDialog.show();
}
</code></pre>
