title: find layout type of a view
body: <p>I have a custom ExpandableListAdapter where I specified the getGroup(...) as following:</p>
  
  <pre><code>@Override
  public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
  
      //do stuff
      if(something) {
          if (convertView == null) {
              LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = vi.inflate(R.layout.tasks_list_group_with_child, null);
          }
  
          TextView taskNameText = (TextView) convertView.findViewById(R.id.tlgwc_task_name);
          //do stuff
  
  
      } else {
          if (convertView == null) {
              LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = vi.inflate(R.layout.tasks_list_group_without_child, null);        
          }
  
          TextView taskNameText = (TextView) convertView.findViewById(R.id.tlgwoc_task_name);
          //do stuff
  
      }
  
      return convertView;
  }
  </code></pre>
  
  <p>Now the problem is when I change the data that I use in the Adapter, it's possible that the parameter (view object which is reused) 'convertView' of the getGroup(...) method hasn't the correct layout anymore. How do I check if its a View with the R.layout.tasks_list_group_without_child or the R.layout.tasks_list_group_with_child layout?</p>
  
  <p>As the API says "convertView: the old view to reuse, if possible. You should check that this view is non-null and of an appropriate type before using", but how?!</p>