Android SDK with Java Basics: 10


RecycleView Updating ListView is an all-or-nothing affair. If there is a change to the model data — new rows added, existing rows removed, or data changes, the only well-supported solution is to call notifyDataSetChanged() RecycleView components: a layout manager, responsible for organizing the views into various structures (vertical list, grid, staggered grid, etc.) an item … Continue reading Android SDK with Java Basics: 10

Android SDK with Java Basics: 09


Backwards Compatibility Strategies If you wish to conditionally execute some lines of code based on what version of Android the device is running, you can check the value of Build.VERSION, Project: DownloadNotify Suppose we want to download a file. That may take some time. If we are having a service download the file, there is … Continue reading Android SDK with Java Basics: 09

Android SDK with Java Basics: 08


Broadcasts and Broadcast Receivers You can tell Android about broadcasts you wish to receive by adding an element to your manifest. This BroadcastReceiver will be available for broadcasts occurring at any time. No running activity of your app is required. But the process will live for only so long as it takes to execute the … Continue reading Android SDK with Java Basics: 08

Android SDK with Java Basics: 07


SQLite Databases SQLiteOpenHelper wraps up the logic to create and upgrade a database. You need to implementing three methods at minimum, The constructor, takes the Context (e.g., an Activity), the name of the database, an optional cursor factory (typically null), and an integer representing the version of the database schema (typically start at 1 and … Continue reading Android SDK with Java Basics: 07

Android SDK with Java Basics: 06


EventBus 3.x Changes, Note the package name has been changed from de.greenrobot.event.EventBus to org.greenrobot.eventbus.EventBus Method name can be anything, don't need to follow onEventMainThread() Instead you will use @Subscribe annotation above the method name Requesting Permissions To access some information from Android, we, the app developers require some permission. Permissions reside in the manifest using … Continue reading Android SDK with Java Basics: 06

Android SDK with Java Basics: 05


Resource sets and configuration Device configuration changes all the time. User might rotate the screen from portrait to landscape. User might put the device in a dock. Phone might has a full QWERTY keyboard User might switch to a different language When a configuration switches to something else, Android provides special support for such events … Continue reading Android SDK with Java Basics: 05

Android SDK with Java Basics: 04


Toast A Toast displays and disappears on its own without user interaction, no way of knowing if the user even notices it. Hence, the Toast is mostly for advisory messages, such as indicating a long-running background task is completed. Action Bar You can add a res/menu/ directory to your project and place in there menu … Continue reading Android SDK with Java Basics: 04

Android SDK with Java Basics: 03


WebView To display HTML in Android, we will use WebView widget. WebView can handle CSS and JavaScript. It can also support backwards and forwards navigation. Starting in Android 5.0, the implementation of WebView was no longer a part of Android. Rather, it became a separate “System WebView” app, distributed through the Play Store. In Android … Continue reading Android SDK with Java Basics: 03

Android SDK with Java Basics: 02


Debugging app If you see “Force Close” or “Has Stopped” dialogs, then check logcat Logcat Click on Android Monitor from the bottom part of the IDE. LogCat will show your stack traces, diagnostic information from the operating system and from your app. To print a message in logcat, use android.util.Log. Log Level There are various … Continue reading Android SDK with Java Basics: 02

Android SDK with Java Basics: 01


Android Terminology Before diving into actual programming, it is important to know several high-level Android concepts. How much Java do you need Language fundamentals (Flow control etc.) Classes & objects Methods and data members Public, private and protected Static and instance scope Exceptions Threads Collections Generics File I/O Reflection Interfaces We will look into each … Continue reading Android SDK with Java Basics: 01