title: how can using shared preferences string values in surface view class in Android
body: <p>i am implementing one game application in this application i am using shared preferences in preferences Activity </p>
  
  <pre><code>spinnerTheme.setOnItemSelectedListener(new OnItemSelectedListener(){ 
    SharedPreferences prefs1 = getSharedPreferences("TipCalcPreferenceDatabase", 0);
      Editor e = prefs1.edit(); 
  
      public void onItemSelected(AdapterView parent,View v,int position,long id)
    {
              prefs = getSharedPreferences("TipCalcPreferenceDatabase", 0);
              Editor e = prefs.edit(); 
              String str;
              if(position==0)
              {
                  str=  String.valueOf((R.drawable.image1));
                  e.putString("TipCalcPropertyName", str); 
  
             }
              if(position==1)
            {
                   str=  String.valueOf((R.drawable.image2));
                   e.putString("TipCalcPropertyName", str); 
  
              }
              else if(position==2)
            { 
                  str=  String.valueOf((R.drawable.ballon_background));
              e.putString("TipCalcPropertyName", str); 
  
          }
           e.commit();
  
              /* Preferences current Theme update  START*/
                  String mySetting = prefs.getString("TipCalcPropertyName", "");
                  LinearLayout ln=(LinearLayout) findViewById(R.id.LinearLayout);
                  ln.setBackgroundResource((int) Double.parseDouble(mySetting) );
  
  
    }
      public void onNothingSelected(AdapterView&lt;?&gt; arg0) 
      {
              // TODO Auto-generated method stub
      }
  });
  </code></pre>
  
  <p>above  sharedprefrences how can implementing in surface view class </p>
  
  <p>this is the surface class initialize()  abstract method extends to layout class</p>
  
  <pre><code>public void initialize() 
      {
          int n;
         Bitmap background;
          // Screen size
        Log.v("height",scwidth+"is width and height is "+scheight);
  
  
          background=getImage(R.drawable.image1);
  
          background = background.createScaledBitmap(background,scwidth,scheight, true);
  }
  </code></pre>
  
  <p>below xml file is surface view </p>
  
  <pre><code>&lt;com.softwares.bird.BirdGame xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/ll_absolute"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="#FF000000" android:orientation="horizontal"&gt;
  
  
  &lt;/com.softwares.bird.BirdGame&gt;
  </code></pre>
  
  <p>this shared prefrences values how can pass surface view class 
  forward valuable suggestion i am struck in this issue in more days 
  thanks in advance</p>