Comments (21)
Can't be done because of method visibility on PreferenceManager
and PreferenceScreen
.
from actionbarsherlock.
This may be possible with a bit of work on second thought...
from actionbarsherlock.
I have a some idea of this.
PreferenceFragment is just abstract class that extends Fragment that depend on PreferenceActivity.
from actionbarsherlock.
I have the beginnings of the class here: https://gist.github.com/1108374
It is based on the decompiled source of Android 3.1. It doesn't compile at present but it's a start. There are a lot of internal APIs in use on the official version of the class. We can't depend on PreferenceActivity
so some of these methods will have to have their implementations duplicated. I don't have the time to look at it just yet.
from actionbarsherlock.
This is being worked on in a private repo for now. Once it is compiling I'll make it public. It will be at https://github.com/JakeWharton/Android-PreferenceFragment.
from actionbarsherlock.
Have you made any progress since Augustus 2010? I would like to set my preference in a ViewPager but that gives me serious headache!
from actionbarsherlock.
Haven't touched it since. Working on ABS v4 now. I might try it once that is completed.
from actionbarsherlock.
@ChristopheVersieux it shouldn't be too difficult to do it yourself, here's the ICS source for PreferenceFragment
from actionbarsherlock.
I believe it uses internal PreferenceManager
and PreferenceScreen
APIs which is why I gave up on it initially until the sources were available. The tricky part will be ensuring it can still work with things that extend android.preference.Preference
. It's not a requirement, but would be great for a proper solution.
from actionbarsherlock.
Thank a lot for your help, I found this one in the meanwhile: http://forum.xda-developers.com/showpost.php?p=19719977&postcount=1
With a perfectly working example.
Great job everybody and thank for your quick help.
from actionbarsherlock.
Cool. Thanks for the link. That method uses reflection to access the internal APIs so I'll still probably have a go at creating a proper implementation eventually. Glad that works for you for now though.
from actionbarsherlock.
Hi Jake, do you plan to work on it? It s not the most useful class in the world, but it would help to have it :)
from actionbarsherlock.
Please continue development on this, I beg you.
from actionbarsherlock.
Yes - I need to use loaders and fragments in preference activity when some items are clicked and cannot!
from actionbarsherlock.
Here seems to be an impressive Unified solution:
https://github.com/saik0/UnifiedPreference
from actionbarsherlock.
@paulpv did you manage to use UnifiedPreference as a SherlockFragment? I am experienceing the following issue:
04-18 03:59:26.000: E/AndroidRuntime(8437): FATAL EXCEPTION: main
04-18 03:59:26.000: E/AndroidRuntime(8437): java.lang.ClassCastException: si.neanonimen.Settings$NetSettingsPrefsFragment cannot be cast to android.support.v4.app.Fragment
04-18 03:59:26.000: E/AndroidRuntime(8437): at android.support.v4.app.Fragment.instantiate(Fragment.java:384)
NetSettingsPrefsFragment extends UnifiedPreferenceFragment
from actionbarsherlock.
Hello, I have this code, and when trying to adapt it for use actionbarsherlock I can not use the getFragmentManager, that I can do?
Change to SherlockPreferenceActivity and actionbar by getSupportActionBar, but getFragmentManager fails me ... Why?
public class Settings extends PreferenceActivity{
@OverRide
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
ActionBar actionBar = getActionBar();
actionBar.setTitle(R.string.preferencias);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setHomeButtonEnabled(true);
actionBar.setIcon(R.drawable.actionbar_cerrar);
getFragmentManager().beginTransaction().replace(android.R.id.content,
new SettingsFragment()).commit();
}
from actionbarsherlock.
Hi Jake,
are you still working on this or do you plan to?
from actionbarsherlock.
I wrote a compatibility layer for PreferenceFragment. Java reflection is used extensively to access private/hidden methods and fields. It's available here:
https://github.com/kolavar/android-support-v4-preferencefragment
from actionbarsherlock.
@kolavar, your compatibility layer is brilliant, and working perfectly in my app. Thank you so much for the contribution. I have mostly had success using it in combination with ABS by having your PreferenceFragment class extend from SherlockFragment instead of the Fragment class in the support library.
from actionbarsherlock.
@kolavar , yep, compatibility is great! Thank you very much!
from actionbarsherlock.
Related Issues (20)
- Android 5 crash HOT 1
- can not import with build-tools-21.0.2 HOT 1
- Android L Upgrade HOT 1
- ActionBar Height is double in landscape on GT-S5360 2.3.6
- No resource found that matches the given name 'Theme.AppCompat.Light' HOT 1
- Sherlock dialog not dislpaying on devices with android v4+? HOT 1
- different proform in different devices
- ActionBarSherlock is incompatible with Appcompat HOT 4
- Various png files generate libpng warnings in Android Studio 1.1.0 or Gradle HOT 2
- SherlockFragmentActivity with TabHost, the item activity getActionBar null HOT 1
- Compile with API level 22 error: Error:In <declare-styleable> SherlockSpinner, unable to find attribute android:popupPromptView
- Migrating from sherlock to appcompat does not reduce apk size HOT 1
- Alert Dialogue and Pop up menu theme
- "titleTextStyle" has already been defined
- Watson.java mFragmens.mAdded can't find HOT 8
- Watson.java HOT 1
- Test
- Sherlock? HOT 1
- Tab size issue with Android 7.0 HOT 2
- SherlockActionbar conflicts with latest FacebookSdk facebook-android-sdk:[4,5) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actionbarsherlock.