title: Android Preferences how to go
body: <p>In one of my activity's onCreate I am using the following to get the list view. The xml layout being applied is from xml file "country_row". Now I want to use shared preferences to change some of the layout of my listview for eg font color, background color which should be preserved. As I know I can achieve this using the shared preferences. But assuming that I know the way to define it in xml file, in this section how can I apply some of the changes say different font color or background color using the same "country_row" xml file. Or do I have to completely define new xml file? What is the way I am confused.</p>
  
  <pre><code>   public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 
          int sort = prefs.getInt("sort_pref", -1); // -1 will be the result if no preference was set before 
          if(sort == 1) 
              sortOrder = "year";//sort on year 
          else if (sort == 2)
              sortOrder = "country";//sort on country
  
  
          ContentResolver contentResolver = getContentResolver();
  
          Cursor c = contentResolver.query(CONTENT_URI, null, null, null, sortOrder);     
          String[] from = new String[] { "year", "country" };
          int[] to = new int[] { R.id.year, R.id.country };       
          SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.country_row, c, from, to);     
  
      setListAdapter(sca);
  }
  </code></pre>