Shared Preference Force close
<p>My Program gets Force closed when i execute this code.. can anyone tell me..whats the solution..
package com.test.sharedPreferences;</p>

<pre><code>import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.TextView;

public class Sharedpreference extends Activity {
    @Override
     public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      SharedPreferences pref = getSharedPreferences("Preference",MODE_WORLD_READABLE);
      SharedPreferences.Editor editor = pref.edit();
      editor.putBoolean("keyBoolean", true);
      editor.putFloat("keyFloat", 1.0f);
      editor.putInt("keyInt", 1);
      editor.putLong("keyLong", 1000000L);
      editor.putString("keyString", "Hello Android");
      editor.commit();

//    boolean dataFromPrefBool = pref.getBoolean("keyBoolean", false);
//    float dataFromPrefflaot = pref.getFloat("keyFloat", 0.0f);
      int dataFromPrefInt = pref.getInt("keyInt", 0);
//    long dataFromPrefLong = pref.getLong("keyLong", 0);
//    String dataFromPrefString = pref.getString("keyString", null);

      TextView tv = new TextView(this);
      tv.setText(dataFromPrefInt);
      setContentView(tv);

     }
    }
</code></pre>
