Thursday, 23 May 2013

Read inbox messages of a particular number and display them in an activity

Share Preference in Android

Create Share Preference:

                 SharedPreferences sp=getSharedPreferences("HB", 0);
                SharedPreferences.Editor Ed=sp.edit();
                Ed.putString("HBstr",Value );             

Get Value from Share preference:

                    SharedPreferences sp1=this.getSharedPreferences("HB",null);
          String abc=sp1.getString("HBstr", defValue);

          SharedPreferences sp2=this.getSharedPreferences("HB",0);
          int  fontsize = sp2.getInt("INTnm", 0);

          SharedPreferences sp3=this.getSharedPreferences("HB",0);
          boolean ans_bg=sp3.getBoolean("BOOLEANnm",false);

I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)