Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Source not found. (while trying to do the Tab Layout tutorial)
    text
    copied!<p>I'm trying to do the Tab Layout tutorial and my code crashes because of "Source not found" on the lines : </p> <pre><code> intent = new Intent().setClass(this, FavouritesActivity.class); spec = tabHost.newTabSpec("favourites").setIndicator("favourites", res.getDrawable(R.drawable.ic_tab_favourites)) .setContent(intent); tabHost.addTab(spec); </code></pre> <p>and to be more specific it crashes on :</p> <pre><code>res.getDrawable(R.drawable.ic_tab_favourites) </code></pre> <p>I do have a class named FavouritesActivity and ic_tab_favourites.xml‬ file on res/drawable (Eclipse even autocompletes those two...).</p> <p>Any idea on what could be wrong ?</p> <p>edit: I found that the code in ic_tab_favourites.xml‬ is the problem, the code is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- When selected, use grey --&gt; &lt;item android:drawable="@drawable/ic_tab_favourites_gray" android:state_selected="true" /&gt; &lt;!-- When not selected, use white--&gt; &lt;item android:drawable="@drawable/ic_tab_favourites_white" /&gt; &lt;/selector&gt; </code></pre> <p>and the problem is with the drawable resources "ic_tab_favourites_gray", "ic_tab_favourites_white".</p> <p>but I don't know why, Eclipse autocompletes them when I edit the .xml file and I do have ic_tab_favourites_gray.ico, ic_tab_favourites_white.ico </p> <p>edit 2 : if for example I change the .xml to : </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- When selected, use grey --&gt; &lt;item android:drawable="@drawable/ic_tab_main_gray" android:state_selected="true" /&gt; &lt;!-- When not selected, use white--&gt; &lt;item android:drawable="@drawable/ic_tab_main_gray" /&gt; &lt;/selector&gt; </code></pre> <p>than it works (but ofcourse I don't want ic_tab_main_gray icon for this tab...)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload