title: Binary XML file line #17: Error inflating class <unknown> - unpredictable error
body: <p>I'm trying to inflate layout to custom adapter in <code>getView(...)</code> method but <strong>sometimes</strong> I get an error in title. I already tried to search in similar questions here but I didn't find a solution which worked for me. This error is strange because it occurs just sometimes and only on some devices - complete log is bellow</p>
  
  <pre><code>android.view.InflateException: Binary XML file line #17: Error inflating class &lt;unknown&gt;
              at android.view.LayoutInflater.createView(LayoutInflater.java:606)
              at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
              at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
              at cz.anywhere.sochi.adapter.NewsAdapter.getView(NewsAdapter.java:35)
              at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
              at android.widget.AbsListView.obtainView(AbsListView.java:2040)
              at android.widget.ListView.makeAndAddView(ListView.java:1772)
              at android.widget.ListView.fillDown(ListView.java:672)
              at android.widget.ListView.fillSpecific(ListView.java:1330)
              at android.widget.ListView.layoutChildren(ListView.java:1603)
              at android.widget.AbsListView.onLayout(AbsListView.java:1870)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:443)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1652)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1510)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1415)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:443)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:443)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1589)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1652)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1510)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1415)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:443)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:443)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:690)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:443)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1652)
              at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1510)
              at android.widget.LinearLayout.onLayout(LinearLayout.java:1415)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.widget.FrameLayout.onLayout(FrameLayout.java:443)
              at android.view.View.layout(View.java:11418)
              at android.view.ViewGroup.layout(ViewGroup.java:4328)
              at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1489)
              at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
              at android.os.Handler.dispatchMessage(Handler.java:99)
              at android.os.L
  </code></pre>
  
  <p>Here is a source code from Adapter where I'm trying to inflate <code>item_news.xml</code>layout.</p>
  
  <pre><code> @Override
      public View getView(int position, View v, ViewGroup parent) {
  
          if (v == null) {
              v = getInflater().inflate(R.layout.item_news, null);
  
              ViewHolder holder = new ViewHolder();
              holder.newsImage = (ImageView) v.findViewById(R.id.news_image);
              holder.title = (TextView) v.findViewById(R.id.news_title);
              holder.date = (TextView) v.findViewById(R.id.news_date);
              holder.progressBar = (ProgressBar) v.findViewById(R.id.news_progress);
              holder.source = (ImageView) v.findViewById(R.id.news_source_logo);
  
              v.setTag(holder);
          }
  
          final ViewHolder h = (ViewHolder) v.getTag();
  
          final News news = getItem(position);
  
          if(news.getImage() == null){
              //TODO - if image isn't available illustration photo must be shown
              h.progressBar.setVisibility(View.GONE);
          }else{
  
              Picasso.with(getContext()).load(SochiApp.BASE_URL + news.getImage().getSmall()).into(h.newsImage, new Callback() {
                  @Override
                  public void onSuccess() {
                      h.progressBar.setVisibility(View.GONE);
                  }
  
                  @Override
                  public void onError() {
                      SochiLog.e(TAG, SochiApp.BASE_URL + news.getImage().getSmall() + " load image error");
                      h.progressBar.setVisibility(View.GONE);
                  }
              });
          }
  
          h.title.setText(news.getTitle());
          h.date.setText(news.getDate_create());
  
          String category = news.getCategory();
  
          h.source.setVisibility(View.GONE);
  
          if(category.equals(FiltrPreferences.NEWS)){
  //            h.source.setImageResource(R.drawable.news_logo);
  
          }else if(category.equals(FiltrPreferences.EXCLUSIVE)){
              h.source.setImageResource(R.drawable.exclusive_logo);
              h.source.setVisibility(View.VISIBLE);
          }else if(category.equals(FiltrPreferences.LETNA)){
  //            h.source.setImageResource(R.drawable.czech_official_logo);
          }
  
          return v;
      }
  
      private static class ViewHolder {
          ImageView newsImage;
          ProgressBar progressBar;
          TextView title;
          TextView date;
          ImageView source;
      }
  </code></pre>
  
  <p>And <code>item_news.xml</code></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:padding="10dp"
          android:layout_height="130dp"&gt;
  
          &lt;RelativeLayout
              android:layout_width="0dp"
              android:layout_weight="1"
              android:layout_height="match_parent"&gt;
  
              &lt;ImageView
                  android:id="@+id/news_image"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:scaleType="centerCrop"
                  android:src="@drawable/dummy_image" /&gt;
  
              &lt;ProgressBar
                  android:id="@+id/news_progress"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerInParent="true" /&gt;
  
          &lt;/RelativeLayout&gt;
  
  
          &lt;RelativeLayout
              android:layout_width="0dp"
              android:layout_weight="2"
              android:layout_height="match_parent"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:paddingLeft="10dp"
                  android:orientation="vertical"&gt;
  
                  &lt;TextView
                      android:id="@+id/news_title"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      style="@style/newsTitle"
                      android:text="@string/dummy_text" /&gt;
  
  
                  &lt;TextView
                      android:id="@+id/news_date"
                      android:text="@string/dummy_text"
                      android:layout_marginTop="5dp"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content" /&gt;
  
  
              &lt;/LinearLayout&gt;
  
              &lt;ImageView
                  android:id="@+id/news_source_logo"
                  android:adjustViewBounds="true"
                  android:layout_alignParentBottom="true"
                  android:layout_alignParentRight="true"
                  android:layout_marginBottom="5dp"
                  android:layout_marginRight="5dp"
                  android:layout_width="15dp"
                  android:src="@drawable/exclusive_logo"
                  android:layout_height="wrap_content" /&gt;
  
  
          &lt;/RelativeLayout&gt;
  
  
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The error occurs on <code>@+id/news_image</code> ImageView but it appears unpredictably and only on some devices (on Galaxy S4 with Android 4.3 everything works but on Galaxy S3 Android 4.1.2 application sometimes crash on this error)</p>
  
  <p>Thanks for help.</p>