alert dialog not working
<p>i am making a grid layout and want to put it in an alert dialog.but when i try to show the alert dialog using show(),but the alert dialog is not showing the <code>GridView</code> .Instead,it is showing the dialog in the front and the <code>GridView</code> in the background in which the grid items are not clickable.Here is the coding:</p>

<pre><code>public class GridViewActivity extends Activity {


Context context;
View layout;
static final String[] MOBILE_OS = new String[] { "timer", "about"};

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    GridView gridView = (GridView)findViewById(R.id.gridView1);
    gridView.setAdapter(new ImageAdapter(this, MOBILE_OS));
    gridView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView&lt;?&gt; parent, View v,
                int position, long id) {

            if(position == 0){
                Toast.makeText(GridViewActivity.this, "first icon is pressed", Toast.LENGTH_SHORT).show();
            }
            else if(position == 1){
                Toast.makeText(GridViewActivity.this, "second icon is pressed", Toast.LENGTH_SHORT).show();
            }
        }});
    Dialog();
}   
public void Dialog(){

    AlertDialog alertDialog;
    Context mContext = GridViewActivity.this;

    AlertDialog.Builder builder = new AlertDialog.Builder(GridViewActivity.this);
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);

    View layout = inflater.inflate(R.layout.main,null);

    builder.setView(layout);
    alertDialog = builder.create();
 alertDialog.show();
  }

}
</code></pre>

<p>Please tell me how to solve this problem.</p>
