Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref_headers cannot be resolved or is not a field #14

Closed
Ibochkarev opened this issue May 4, 2013 · 1 comment
Closed

pref_headers cannot be resolved or is not a field #14

Ibochkarev opened this issue May 4, 2013 · 1 comment

Comments

@Ibochkarev
Copy link

Adding to the project library created a folder xml for a file called hml. In the activity of adding the file and get an error

package ru.test.android.enviroment;

import android.R;
import android.content.Context;
import android.os.Bundle;

import net.saik0.android.unifiedpreference.UnifiedPreferenceFragment;
import net.saik0.android.unifiedpreference.UnifiedSherlockPreferenceActivity;

public class PreferenceActivity extends UnifiedSherlockPreferenceActivity {

    @Override public void onCreate(Bundle savedInstanceState) {
        // Set header resource MUST BE CALLED BEFORE super.onCreate
                setHeaderRes(R.xml.pref_headers);
                // Set desired preference file and mode (optional)
    }

    public static class GeneralPreferenceFragment extends UnifiedPreferenceFragment {}
}

Error:
pref_headers cannot be resolved or is not a field PreferenceActivity.java /SplashActivity/src/ru/test/android/enviroment line 14 Java Problem

@jromero
Copy link

jromero commented Jun 10, 2013

You are importing android.R instead of ru.test.android.enviroment.R class.

Such that...
pref_headers should be a file on YOUR project.
It should be located under /res/xml/pref_headers.xml

For contents see:
https://github.com/saik0/UnifiedPreference/blob/master/demo/res/xml/pref_headers.xml
and:
https://github.com/saik0/UnifiedPreference/blob/master/demo/res/xml/pref_general.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants