Skip to content Skip to sidebar Skip to footer

Saving Text Size In Shared Preference

I'm trying out to save the text size in shared preference ,while running the project my application stops unexpectedly here is the code : SharedPreferenceActivity.class package c

Solution 1:

find the views in your onCreate method.

public void onCreate(Bundle savedInstanceState)
{
 super.onCreate(savedInstanceState);

 setContentView(R.layout.main);
 seek=(SeekBar)findViewById(R.id.seekBar1);
 ed1=(EditText)findViewById(R.id.editText1);
 b=(Button)findViewById(R.id.button1);
 ...
 ...
}

Solution 2:

ed1 is not initialize using findviewbyId in Oncreatre.....

as you can only get ed1 when you have set the content view in onCreate

b, ed1, seekbar all should be initialize after this line " setContentView(R.layout.main);" using findviewbyId in Oncreatre.....


Post a Comment for "Saving Text Size In Shared Preference"