title: Showing Grid View in popup Window
body: <p>I have a problem that I want to show a Custom <code>GridView</code> in Popup window with images and Text. Images are coming from webservice, but my adapter is unable to show the <code>GridView</code> Items. I don't know why? Please suggest me any solution regarding the same.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>private void showSearchPopUp()
      {
          View view = LayoutInflater.from(VideoActivity.this).inflate(R.layout.search_pop_up, null);
          PopupWindow popupWindow = new PopupWindow(
                     view, 
                     LayoutParams.WRAP_CONTENT,  
                           LayoutParams.WRAP_CONTENT);  
          popupWindow.setWidth(1230);
          popupWindow.setHeight(800);
          //popupWindow.showAtLocation(imgSearch, Gravity.LEFT|Gravity.TOP, 0, -30);
          popupWindow.showAsDropDown(relHeader, 0, -30);  
  
          LinearLayout llSearchAlpha = (LinearLayout)view.findViewById(R.id.llSearchAlpha);
          TextView tvAlpha;
          for(int i=0;i&lt;alpha.length;i++)
          {
              tvAlpha = new TextView(VideoActivity.this);
              tvAlpha.setTextColor(Color.WHITE);
              tvAlpha.setText(alpha[i]);
              tvAlpha.setTextSize(15);
              tvAlpha.setLayoutParams(new LinearLayout.LayoutParams(
                          LayoutParams.WRAP_CONTENT,
                          LayoutParams.WRAP_CONTENT, 1f));
              llSearchAlpha.addView(tvAlpha);
          }
          getActors();
      }
  
  private void getActors()
      {
          View view = LayoutInflater.from(VideoActivity.this).inflate(R.layout.search_pop_up, null);
          final GridView grid = (GridView)view.findViewById(R.id.gvSearch);
          grid.setWillNotDraw(false);
          grid.setFocusableInTouchMode(true);
          grid.setClickable(true);
          new Thread(new Runnable() {
  
              @Override
              public void run() {
                  actors = Server.getSearchActor();
                  runOnUiThread(new Runnable() {
  
                      @Override
                      public void run() {
                          SearchActorCategoryLazyAdapter searchAdapter = new SearchActorCategoryLazyAdapter(VideoActivity.this, actors);
                          grid.setAdapter(searchAdapter);
                      }
                  });
              }
          }).start();
      }
  
  public class SearchActorCategoryLazyAdapter extends BaseAdapter 
  {
      Context _contextObj;
      List&lt;Actor&gt;  listActor;
      private LayoutInflater inflater;
      private ImageLoader imageLoader;
      public SearchActorCategoryLazyAdapter(Context context, List&lt;Actor&gt; listActor)
      {
          _contextObj = context;
          this.listActor = listActor;
          this.inflater = (LayoutInflater) _contextObj.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          this.imageLoader = new ImageLoader(_contextObj.getApplicationContext());
      }
      @Override
      public int getCount() 
      {
          return listActor.size();
      }
      @Override
      public Object getItem(int position) 
      {
          return null;
      }
      @Override
      public long getItemId(int position) 
      {
          return 0;
      }
  
      static class ViewHolder 
      {
          TextView tvActorName;
          ImageView imgSearch;
          int position;
      }
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          ViewHolder viewHolderObj = new ViewHolder();
  
          LayoutInflater inflaterObj = (LayoutInflater)_contextObj.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
  
  
               if (convertView == null) {
                   convertView = (View)inflaterObj.inflate(R.layout.search_griditem, parent,true);
                  }
              viewHolderObj.tvActorName = (TextView)convertView.findViewById(R.id.tvSearchName);
              viewHolderObj.imgSearch = (ImageView)convertView.findViewById(R.id.imgSearch);
  
              viewHolderObj.tvActorName.setText(listActor.get(position).getActor_name());
              Activity activity = (Activity)_contextObj;
              imageLoader.displayImage(listActor.get(position).getActor_image(), activity, viewHolderObj.imgSearch);
  
  
          return convertView;
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>