2016-07-29 105 views
0

這個適配器被調用,但內部適配器已調用/不設置視圖:調用適配器形成另一個適配器?

@Override 
     public View getView(int position, View convertView, ViewGroup parent) { 
      UserContact user = getItem(position); 


      if(convertView==null) 
       { 
       convertView = inflter.inflate(R.layout.viewtemplate,null); 
       calpha = (TextView) convertView.findViewById(R.id.alpha); 
       gridCustomView = (GridCustomView) convertView.findViewById(R.id.myGrid); 
       gridCustomView.setExpanded(true); 

       } 

//////////////////////// //////////

 calpha.setText("section head"+position); 
     gridadapter = new GridAdapter(context,user,position); 
    //This gridadapter is not calling ,not setting it's view. 
     gridCustomView.setAdapter(gridadapter); 



     return convertView; 
     } 
+0

你能向我們展示GridAdapter的getView/constructor方法 –

回答

0

嘗試在getView

調用notifyDataSetChanged()使用setAdapter(gridadapter)後,你應該使用ViewHolder模式來保存gridadapter和所有視圖。