기본 콘텐츠로 건너뛰기

1월, 2016의 게시물 표시

Android, SharedPreferences, store Object, sample

//Test : obj( ArrayList<Map>) public static void saveObj (Context context, Object obj){ SharedPreferences. Editor editor = context. getSharedPreferences (STORAGE_KEY, 0 ). edit (); Gson gson = new Gson(); String json = gson. toJson (obj); editor. putString (OBJ_KEY, json); editor. commit (); } public static Object loadObj (Context context){ SharedPreferences prefs = context. getSharedPreferences (STORAGE_KEY, 0 ); String json = prefs. getString (OBJ_KEY, null ); Gson gson = new Gson(); Object obj = gson. fromJson (json, Object. class ); return obj; }

Android, Device unique key

** required : cellular model chip TelephonyManager tManager = (TelephonyManager)getSystemService(Context. TELEPHONY_SERVICE ); String uuid = tManager. getDeviceId (); ** required : WiFi on WifiManager manager = (WifiManager) getSystemService(Context. WIFI_SERVICE ); WifiInfo info = manager. getConnectionInfo (); String address = info. getMacAddress (); ** required :  Android 4.0 (API 14) String uuid = Build. SERIAL ;

Android, no title bar, no status bar

** styles.xml   add < item name= "windowNoTitle" >true</ item > < resources > < style name= "AppTheme" parent= "Theme.AppCompat.Light.DarkActionBar" >     ... < item name= "windowNoTitle" >true</ item > //add this line </ style > </ resources > < item name= "windowNoTitle" >true</ item > -> no title bar only. < item name= "windowFullscreen" >true</ item > -> no status bar.

linux, format ext3

$ sudo -s # fdisk -l # umount /dev/sdb1 # fdisk /dev/sdb n p # mke2fs -c /dev/sdb1 # tune2fs -j /dev/sdb1 # e2label /dev/sdb1 sdcardvolume # chown -R user:user /media/sdcard ref :  http://tungchingkai.blogspot.jp/2008/01/format-sd-card-to-linux-filesystem-in.html