Model-View-Presenter in Android

What is Model-View-Presenter (MVP) MVP is a Model-View-Presenter in short. It is a derivative from Model-View-Controller (MVC) architectural pattern. The main concern about MVP structure is that it separates the view from the backend logic. Because Android doesn't care about which pattern to be used when developing, the community developer…

Android Runtime Permission

The basic of runtime permission as of Android 6.0 Our plan is to make use of Camera and Storage permission. Declare these in the manifest file. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"…

Passing data through Activities

Updated on Nov 29, 2016 - added information on EventBus sticky Assume we have a simple POJO which contains multiple information public class POJO { public int integer; public String string; public Boolean bool; public Float f; public POJO(int integer, String string, Boolean bool, Float f) { this.integer = integer; this.…

Android Logging Utility

Below is a snippet code for logging your application in logcat. Usage: Simply create a class called L.java and use it in your code. public final class L { private static final String LOG_TAG = "ShopperMate_Log"; private static final boolean DEBUG = true; public static void e(String…

Android Debug Bridge (ADB) Shell

A simple plain ADB shell command for my every day debug routine. Check for devices: $ adb devices Connect to device: a) Single device $ adb shell b) Multiple device $ adb -s <device_name> shell Pulling from remote: $ adb -s <device_name> pull <source_file> <…

ActiveAndroid Schema Migration

Today I learned something. Something other people have already learned long time ago. While I was debugging MindFuel app, I noticed that I have missed a column in one of its database table. So I go around and do some research on how to do a schema migration to add…

Android Image Multi-Part Upload

This tutorial will guide you through building an app component for uploading image to a server. I'm gonna use PHP as my server side script to receive the image from the client. tl;dr Github source Prerequisite OkHttp 3.2.0 Client side First, let's create a simple UI for…

Nested RecyclerViews

In this guide, we'll be looking at how to implement a nested RecyclerView. We'll be having two RecyclerViews, one of it being a parent of a child RecylerView. Although it is NOT encouraged to do this in practice, but it is good to know such complex layout can be done…

Implementing RecyclerView Click Listener

Implementing item click listener on RecyclerView using Interface method. Interface public interface CustomItemClickListener { void onItemClick(View v, int position); void onActionClick(View v, int position); } Fragment ObjectAdapter objectAdapter = new ObjectAdapter(itemsList, new CustomItemClickListener() { @Override public void onItemClick(View v, int position) { Toast.makeText(getActivity(), "Card Clicked: " + position, Toast.…

Android Dialog Reveal Animation

Style definition res/values/styles.xml <resources ... > ... <style name="CustomAnimations"/> <!-- Sliding animation --> <style name="CustomAnimations.slide"> <item name="android:windowEnterAnimation">@anim/slide_in_left</item> <item name="android:…