Android Saving Files on Internal and External Storage

Android allows us to store files in its file system which is quite similar to any other Linux filesystem that you must have experience with. Using the java.io file input/output APIs we can start reading and writing files to the Android filesystem. This is super useful when you want a store files (but not relational data or some sort of key/value cache pairs) on the device. Files like audio, video, images, documents, etc. all makes sense to store in the file system when required.

Continue reading

Android Application Data Storage With SharedPreferences

Android has a concept of shared preferences using which application preferences data can be stored persistently. That means the data or state won’t be lost until the application is uninstalled. The preferences data can be stored as key/value pairs and are available across all the Activities of the given application or can also be restricted to a particular Activity.

Continue reading

Execute ADB Commands To Query a Particular Android Device/Emulator

When using the versatile Android Debug Bridge (adb) tool to issue commands, if there’s only one device or emulator attached then that’s fine as the commands will be executed on exactly that. But if there’s more than one instance then we’ll get an error on the terminal saying error: more than one device and emulator.

Continue reading

Android Image Slideshow using ViewPager with PagerAdapter

We’ve already discussed ViewPager in depth in one of my earlier posts. We saw how to use it with specific PagerAdapter implementations like FragmentPagerAdapter and FragmentStatePagerAdapter that works with fragments but we can also use it to inflate any other View or ViewGroup (with standard View hierarchy) by hooking it up with PagerAdapter itself. In this tutorial we’ll just discuss how to how to hook a PagerAdapter to a ViewPager to create an Image slideshow.

Continue reading