Note that there are some explanatory texts on larger screens.

plurals
  1. POInside Peference Activity, Create a Listview of Themes to Enable for the App
    primarykey
    data
    text
    <p>I have a application in which i have a preference acitivty which loads my settings xml. Now, what i want to do is implement a listview of themes to enable for the application. i know how to setup a listview in the settings xml for the most part, but i dont know how to enable different themes for the application. Can anybody point me in the right direction. or have a little sample code.</p> <p>Here is my Preference JAVA file, and here below that is my Settings XML.</p> <pre><code> public class Prefs extends PreferenceActivity { ListPreference listPreference; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settingsbasic); //New Preference customPref = (Preference) findPreference("clearcache"); customPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { Toast.makeText(getBaseContext(), "Cache Cleared", Toast.LENGTH_LONG).show(); WebViewClientDemoActivity.web.clearCache(true); return false; } </code></pre> <p>I do not have my List view yet in the code, any help would be great on how to implement. I just have a clear cache button.</p> <p>Here is my settings XML.</p> <pre><code> &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;CheckBoxPreference android:key="themes" android:title="@string/themes" android:summary="@string/themes_list" android:defaultValue="true" /&gt; &lt;CheckBoxPreference android:key="something" android:title="@string/cache" android:summary="@string/somethingelse" android:defaultValue="true" /&gt; &lt;Preference android:title="Clear Cache" android:summary="Hopefully this Works" android:key="clearcache" /&gt; &lt;/PreferenceScreen&gt; </code></pre> <p>I have 2 check boxes, i want to change the first check box to a list view, and have a array of the list of themes. i just dont know how to enable these themes . Do i create seperate layout files for each theme??? or so i use the themes.xml, if so how do i impletement those by click the object in the listview???</p> <p>Sorry about all the questions. Any help would be great.</p> <p>main.xml file, i am wanting my theme to change the contents of this main.xml. most of the attributes will stay the same.</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/boardimage" android:fadingEdge="vertical" android:orientation="vertical" &gt; &lt;ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/boarder" android:contentDescription="@string/title" android:gravity="center_horizontal" android:src="@drawable/banner" &gt; &lt;/ImageView&gt; &lt;ProgressBar android:id="@+id/progressBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/&gt; &lt;WebView android:id="@+id/webview01" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_gravity="center" android:layout_weight="1.12" &gt; &lt;/WebView&gt; &lt;/LinearLayout&gt; </code></pre> <p>So i want to know how i would go about changing the contents of this xml file. just as on my blue theme i will use a different drawable for the background or a different size of webview, or a image drawable in the imageview. how would i do that. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload