Android boot process

Boot process of embedded system is similar to PC from overview level, but slightly different from microscopic level. Here’s the boot process of an Android device: PC-BIOS/BootMonitor, MBR and GRUB/LILO etc are all combined in one Boot Strap Firmwarecalled Bootloader. Its init.S initializes stacks, zeros the BSS segment and calls _main() in main.c. The main.c…

android get wifi connection states

in my app, i need to notify user before they connect to internet for video if their device is not connected to wifi. To achieve this, we need to add ACCESS_NETWORK_STATE permission in the Manifest file first. you will obviously also need the INTERNET permission. Then we check the state:

change the three dots action bar overflow menu icon in android

To override the icon, we would need a new theme that extends the Holo or HoloLight or… For my app, since I support changing theme, i would need 2 custom theme. These code can be added in the res/values/xxx.xml, i just put in my strings.xml if you just have 1 theme, just set the custom…

refresh android spinner

If you change the underlying “back” list for the spinner, the spinner does not refresh automatically. What we can do is : The notifyDataSetChanged() will force refresh the spinner so that the list change can be applied to the view.

refresh activity on back button in android

Normally, when user click the back button in android, the next view is not refreshed. I had this problem when I was doing the settings. if user changed the some settings and hit back button, the new settings won’t be applied to the “back” list view since all the cells are reused. you can do…

save settings in android app

1. settings use getSharedPreferences(prefFileNameString, mode). I just need 1 settings file in my current app, so I only need to define a string in resource for the “prefFileNameString” and use it across all activities. 2. change theme The above code is used for switch between holo and holo light theme. Make sure they are before…

parse json file in android from asset

1. The JSON Structure I am taking an example of following JSON which will give you list of employees and each employee will have details like id, name, city, gender, age etc. Consider that above JSON data is stored in jsondata.txt file which is stored in assetsfolder. 2. Reading Text File (from assets folder) Before we start parsing…