2012-04-13 4 views
1

私のアプリケーションのユーザーにフォントとテキストサイズを変更することを伝えたい。しかし、どのように私はそれを保存することができますので、Textsizeまたはフォントは、ユーザーが変更した場合、デフォルトとして設定されていますか?Android - 値を変更して保存する

答えて

0

使用SharedPreferences

それ変更を保存し にあなたが設定

SharedPreferences sPref; 
sPref = getPreferences(MODE_PRIVATE); 
Editor ed = sPref.edit(); 
String putString = myEdText.getText().toString(); //users choice 
ed.putString("SAVED_TEXT", putString); 
ed.commit(); 

で、ユーザーの選択を保存し、また、それから

sPref = getPreferences(MODE_PRIVATE); 
String savedText = sPref.getString("SAVED_TEXT", ""); 

and then dinamicly change properties of TextView 
TextView myTextView = (TextView)fidViewByid(...); 
myTextView.setTextSize(Float.valueOf(putString)); 

を読むことができます

関連する問題