title: in fragment gridview cannot display any item or not give any exception?
body: <p>hello sir i use <code>GridView</code> for display image and text list. I apply <code>GridView</code> in activity it work properly but same thing apply in <code>Fragment</code> then it not display any thing.</p>
  
  <p>Fragment code:</p>
  
  <pre><code>public class UserChannelFragment extends Fragment {
  
      GridView mGridView ;
      private boolean mSearchCheck;
  
      public UserChannelFragment newInstance(String text){
          UserChannelFragment mFragment = new UserChannelFragment();
          Bundle mBundle = new Bundle();
          mBundle.putString(Constant.TEXT_FRAGMENT, text);
          mFragment.setArguments(mBundle);
          return mFragment;
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          // TODO Auto-generated method stub      
          View rootView = inflater.inflate(R.layout.user_channel_fragment, container, false);
          rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT ));
  
          mGridView = (GridView) rootView.findViewById(R.id.userChannelGridView) ;
          Tools.log("GRIDVIEW","before adapter");
          UserChannelAdapter adapter = new UserChannelAdapter(getActivity().getApplicationContext(),rootView);
          mGridView.setAdapter(adapter);
          Tools.log("GRIDVIEW", "after adapter set to gridview");
  
  
          return rootView;
      }
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onActivityCreated(savedInstanceState);
          setHasOptionsMenu(true);                                        
      }
  
      @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          // TODO Auto-generated method stub
          super.onCreateOptionsMenu(menu, inflater);      
          inflater.inflate(R.menu.menu, menu);
  
          SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(Menus.SEARCH));
          searchView.setQueryHint(this.getString(R.string.search));
  
          ((EditText)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text))
          .setHintTextColor(getResources().getColor(R.color.white));      
          searchView.setOnQueryTextListener(OnQuerySearchView);
  
          menu.findItem(Menus.ADD).setVisible(true);
          menu.findItem(Menus.UPDATE).setVisible(false);      
          menu.findItem(Menus.SEARCH).setVisible(true);       
  
          mSearchCheck = false;   
      }   
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // TODO Auto-generated method stub
  
          switch (item.getItemId()) {
  
          case Menus.ADD:         
              break;              
  
          case Menus.UPDATE:          
              break;              
  
          case Menus.SEARCH:
              mSearchCheck = true;
              break;
          }       
          return true;
      }   
  
      private OnQueryTextListener OnQuerySearchView = new OnQueryTextListener() {
  
          @Override
          public boolean onQueryTextSubmit(String arg0) {
              // TODO Auto-generated method stub
              return false;
          }
  
          @Override
          public boolean onQueryTextChange(String arg0) {
              // TODO Auto-generated method stub
              if (mSearchCheck){
                  // implement your search here
              }
              return false;
          }
      };  
  }
  </code></pre>
  
  <p>Adapter Code:</p>
  
  <pre><code>class UserChannelItems{
       int imageId ;
      String title ;
       String path ;
      public UserChannelItems(int image,String string){
          Tools.log("GRIDVIEW","Item Constructor 1");
  
          this.imageId = image ; this.title = string;
      }
      public UserChannelItems(String path,String string){
          Tools.log("GRIDVIEW","Item Constructor 2");
          this.path = path ; this.title = string;
      }
      public int getImageId(){ return this.imageId ;}
      public String getTitle(){ return this.title ; }
      public String getPath(){ return this.path ; }
  }
  class UserChannelViewHolder{
      ImageView mImageView ;
      TextView mTextView ;
      UserChannelViewHolder(View view){
          Tools.log("GRIDVIEW","View Holder Constructor");
  
          mImageView = (ImageView) view.findViewById(R.id.userChannelItemImageView);
          mTextView = (TextView) view.findViewById(R.id.userChannelItemTextView) ;
      }
  }
  
  
  public class UserChannelAdapter extends BaseAdapter {
      Context mContext ;
      View view ;
      private ArrayList&lt;UserChannelItems&gt; userChannelList ;
      public UserChannelAdapter(Context context,View v){
          Tools.log("GRIDVIEW","Adapter Constructor");
          this.mContext = context ;
          this.view = v;
  
          userChannelList = new ArrayList&lt;UserChannelItems&gt;();
  
          for(int i=0;i&lt;25; i++){
              UserChannelItems mUserChannelItem = new UserChannelItems(R.drawable.dir,"Folder");
              Tools.log("GRIDVIEW","set Array  "+mUserChannelItem.getTitle()+"  List "+userChannelList.size());
  
              userChannelList.add(mUserChannelItem);
          }
  
      }
      @Override
      public int getCount() {
          return userChannelList.size();
      }
  
      @Override
      public Object getItem(int position) {
          return userChannelList.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          return 0;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          Tools.log("GRIDVIEW","getView()  call");
          View row = convertView ;
          UserChannelViewHolder mViewHolder = null ;
          if(row==null){
  
              LayoutInflater mLayoutInflater = (LayoutInflater) mContext.getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              row = mLayoutInflater.inflate(R.layout.user_channel_item,parent,false);
              mViewHolder= new UserChannelViewHolder(row) ;
              row.setTag(mViewHolder);
          }
          else{
              mViewHolder= (UserChannelViewHolder) row.getTag();
          }
          UserChannelItems item = userChannelList.get(position) ;
          mViewHolder.mImageView.setImageResource(item.getImageId());
          mViewHolder.mTextView.setText(item.getTitle());
          mViewHolder.mImageView.setTag(item);
          return row;
      }
  }
  </code></pre>
  
  <p>Logcat:</p>
  
  <pre><code>D/GRIDVIEW﹕ before adapter
  D/GRIDVIEW﹕ Adapter Constructor
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 0
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 1
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 2
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 3
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 4
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 5
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 6
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 7
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 8
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 9
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 10
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 11
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 12
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 13
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 14
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 15
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 16
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 17
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 18
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 19
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 20
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 21
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 22
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 23
  D/GRIDVIEW﹕ Item Constructor 1
  D/GRIDVIEW﹕ set Array  Folder  List 24
  D/GRIDVIEW﹕ after adapter set to gridview
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ View Holder Constructor
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ View Holder Constructor
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ View Holder Constructor
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ View Holder Constructor
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ View Holder Constructor
  D/GRIDVIEW﹕ getView()  call
  D/GRIDVIEW﹕ View Holder Constructor
  </code></pre>