public Drawable findElementIcon(TGBrowserElement element) throws TGBrowserException {
   Integer style =
       (element.isFolder() ? R.style.BrowserElementIconFolder : R.style.BrowserElementIconFile);
   TypedArray typedArray =
       this.context.obtainStyledAttributes(style, new int[] {android.R.attr.src});
   if (typedArray != null) {
     return typedArray.getDrawable(0);
   }
   return null;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    TGBrowserElement element = this.elements.get(position);

    View view =
        (convertView != null
            ? convertView
            : getLayoutInflater().inflate(R.layout.view_browser_element, parent, false));
    view.setTag(element);

    try {
      TextView textView = (TextView) view.findViewById(R.id.tg_browser_element_name);
      textView.setText(element.getName());

      Drawable elementIcon = this.findElementIcon(element);
      if (elementIcon != null) {
        ImageView imageView = (ImageView) view.findViewById(R.id.tg_browser_element_icon);
        imageView.setImageDrawable(elementIcon);
      }
    } catch (TGBrowserException e) {
      TGErrorManager.getInstance(TGApplicationUtil.findContext(this.context)).handleError(e);
    }
    return view;
  }