title: How to convert int to drawable?
body: <p>I have created a dialog with list of icons, i.e drawables. I have created a grid view to show these icons.</p>
  
  <p>Now I want to get the selected icon and set it to an image view in my activity.</p>
  
  <p>So how can I convert this into drawable so that I can set the selected icon on my activity's image view?</p>
  
  <p>dialog code:</p>
  
  <pre><code> private void showAlertDialog() {
  
          GridView gridView = new GridView(this);
  
          gridView.setGravity(Gravity.CENTER);
          gridView.setPadding(0,20,0,20);
  
  
          int[] mThumbIds = {
                  R.drawable.roundicons05,R.drawable.roundicons08,R.drawable.roundicons02,R.drawable.roundicons03,R.drawable.roundicons04,
                  R.drawable.roundicons16,R.drawable.roundicons37,R.drawable.roundicons06,R.drawable.roundicons07,R.drawable.roundicons05,
                  R.drawable.roundicons09,R.drawable.roundicons10,R.drawable.roundicons11,R.drawable.roundicons12,R.drawable.roundicons13,
                  R.drawable.roundicons14,R.drawable.roundicons15,R.drawable.roundicons16,R.drawable.roundicons17,R.drawable.roundicons18,
                  R.drawable.roundicons19,R.drawable.roundicons20,R.drawable.roundicons22,
          };
  
          gridView.setAdapter(new ImageAdapter(CheckListActivity.this,mThumbIds));
          gridView.setNumColumns(4);
          gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  // do something here
  
               //   icon.setImageDrawable(id);
                  imageId = position;
                  Drawable drawable = getResources().getDrawable(imageId);
                  icon.setImageDrawable(drawable);
  
              }
          });
  
          final MaterialDialog dialog = new MaterialDialog.Builder(CheckListActivity.this)
                  .customView(gridView, false)
                  .title("Select Icon")
                  .negativeText("CANCEL")
                  .canceledOnTouchOutside(true)
                  .build();
  
          dialog.show();
  
  
      }
  </code></pre>
  
  <p>I tried like this  </p>
  
  <pre><code>  imageId = position;
    Drawable drawable = getResources().getDrawable(imageId);
    icon.setImageDrawable(drawable);
  </code></pre>
  
  <p>but this throws no resource found exception.</p>
  
  <p>Thank you..</p>