Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.content.Context;
- import android.content.SharedPreferences;
- import android.preference.PreferenceManager;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.Locale;
- public class Utilities {
- SharedPreferences sp;
- SharedPreferences.Editor editor;
- String value, category, location_id;
- String dateTime;
- public String getUrl(String phpFile){
- String url = "http://hosting.mdp.ac.id/plesir/api/" + phpFile;
- return url;
- }
- public void setCategory(Context context, String category){
- sp = PreferenceManager.getDefaultSharedPreferences(context);
- editor = sp.edit();
- editor.putString("category", category);
- editor.commit();
- }
- public String getCategory(Context context){
- sp = PreferenceManager.getDefaultSharedPreferences(context);
- value = null;
- category = sp.getString("category", value);
- return category;
- }
- public void setLocationId(Context context, String location_id){
- sp = PreferenceManager.getDefaultSharedPreferences(context);
- editor = sp.edit();
- editor.putString("location_id", location_id);
- editor.commit();
- }
- public String getLocationId(Context context){
- sp = PreferenceManager.getDefaultSharedPreferences(context);
- value = null;
- location_id = sp.getString("location_id", value);
- return location_id;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement