android - How to save RatingBar Rating? -


i save rating bar rating user. wondering possible save value inside of sql database or there better way?

you can use ratingbar.getrating() rating value (returns float). indeed saved sql database, find easier use preferences if have single rating save.

    sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this);     preferences.edit().putfloat("rating", ratingbar.getrating()).commit(); 

and can retrieve value using

    preferences.getfloat("rating", 0.0f); 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -