Issue
Just returend to a project I was working on the other day - when I left it, it was running, today Error:(67, 93) error: cannot find symbol variable drawtab1. Could it be something wrong with the manifest, tried to rebuild and clean. But drawtab1 is not showing..
TabHost tabHost = getTabHost();
// Tab for login
TabSpec Login = tabHost.newTabSpec("Login");
// setting Title and Icon for the Tab
Login.setIndicator("", getApplicationContext().getResources().getDrawable(R.drawable.drawtab1));
Intent LoginIntent = new Intent(this, Tab1Activity.class);
LoginIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Login.setContent(LoginIntent);
This is drawtab1
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- When selected -->
<item android:drawable="@drawable/login"
android:state_selected="true" />
<!-- When not selected -->
<item android:drawable="@drawable/login" />
</selector>
This is the Mainfest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tabdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="22"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Tab1Activity"
android:label="@string/title_activity_tab1" >
</activity>
<activity
android:name=".Tab2Activity"
android:label="@string/title_activity_tab2" >
</activity>
<activity
android:name=".Tab3Activity"
android:label="@string/title_activity_tab3" >
</activity>
</application>
</manifest>
Any help with this would be much appreciated.
Solution
There may be a few cases here
1. make sure there is not import android.R import statement.
2. no error in typos in xml file.
3. use only a-z and 0-9 for resource name it must not contain any capital letters or special symbol. Then clean and sync your project.
Answered By - Nitesh Mishra
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.