Disabling Screen Break with Preference Screens through XML.

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Disabling Screen Break with Preference Screens through XML.

Postby MJ » Thu Jul 23, 2009 6:05 am

Hi,

I need to display another PreferenceScreen which occupies
the full screen through xml.


Calling addPrefrencesFromResource(id) with different id results in
Screen Break handled by Preference Framework.


setPreferenceScreen(mPS) could be called again & it works fine but it
is through code...How do I do it through XML?


Neither inflateFromResource() not PreferenceInflater is available so,
I can't use setPreferenceScreen for XML?


Plz do clarify.
MJ
Freshman
Freshman
 
Posts: 3
Joined: Wed Jul 15, 2009 8:21 am

Top

Code Snippet for Preference Screen.

Postby MJ » Fri Jul 24, 2009 3:36 am

Here is a code snippet hoping that someone blessed with Android Knowledge wud answer my query...

continuePreference.xml

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="@string/softwareUpdate">
<Preference android:key="continueUpdate"
android:title="@string/continueUpdate"
android:dialogTitle="@string/continueUpdate" />
</PreferenceCategory>
</PreferenceScreen>

checkPreference.xml

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="@string/softwareUpdate">
<Preference android:key="checkUpdate"
android:title="@string/checkUpdate"
android:dialogTitle="@string/checkUpdate" />
</PreferenceCategory>
</PreferenceScreen>

Now in code, HelloAndroid.java

addPrefrencesFromResource(R.xml.checkpreference);
...
...
if(ok) //Expected Output: To replace checkPreference with continuePreference screen.
addPrefrencesFromResource(R.xml.continuepreference); //Actual Output: Results in Screen break i.e., appending with previous screen. :(
...
...

Whereas if Preference Screen is loaded through code then,
setPreferenceScreen(mPS1);
...
...
if(ok) //Expected Output: To replace checkPreference with continuePreference screen.
setPreferenceScreen(mPS2); //Actual Output: Same as Expected Output :)


Please do let me know how do I replace the preference screen through xml.
MJ
Freshman
Freshman
 
Posts: 3
Joined: Wed Jul 15, 2009 8:21 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests