Reputation: 611
I spended a day looking for solution for this error I downloaded ActionBarSherlock and import library to eclipse I had fixed all errors and this is the last one I Checked all layouts there is no xml error, Cleaned workspace and restarted eclipse
this is error descrition :
Description Resource Path Location Type mAdded cannot be resolved or is not a field Watson.java /abs_library/src/android/support/v4/app line 59 Java Problem
The code
if (mFragments.mAdded != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible
&& f instanceof OnCreateOptionsMenuListener) {
show = true;
((OnCreateOptionsMenuListener) f).onCreateOptionsMenu(
menu, inflater);
if (newMenus == null) {
newMenus = new ArrayList<Fragment>();
}
newMenus.add(f);
}
}
}
Thank you
Upvotes: 4
Views: 2679
Reputation: 75
if you updated your android-support-v4.jar, just replace these three lines of code
if (mFragments.mAdded != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
with
List<Fragment> actives = mFragments.getActiveFragments(null);
if (actives != null) {
for (int i = 0; i < actives.size(); i++) {
Fragment f = actives.get(i);
...
everything will be ok.
Upvotes: 4
Reputation: 2296
I found a solution: 1# download SherlockActionBar sources from here: https://github.com/JakeWharton/ActionBarSherlock/releases 2# if you're using android-support-v4.jar in your project (as I am) -> replace it from ZIP #1 (you can find it in 'libs' folder) It helps me.
Note: I had 2 versions of android-support-v4.jar in my project:
Upvotes: 0