Toast MyToast

In this post we will be talking about the most helpful feature provided by Android for a quick notification to user, i.e. Toasts “Small informative texts shown at bottom-center of device screen, for defined time duration”.

Default UI design of these toasts is a semi-transparent dark color background with white text over it, not even showing the name of application which spawned it, no so eye-catching, right? I know… So, let’s make a custom Toast Notification that complements our awesome UI…

Continue reading

Optimized ListView Having Listener within The Row Items

ListView is an extensively used widget in Android Applications for displaying data in a structured way. To display custom made views as row elements, it is always preferred to associate Base Adapter with ListView. This is how a BaseAdapter can be used to show a list in which each element contains a text field and a checkbox:

MainActivity.java

// Initialize the ListView and set its adapter.
ListView listView = (ListView) findViewById(R.id.list_view);
listView.setAdapter(new NormalListAdapter((Context) this));

Continue reading

Change Proximity Sensor Events by Using Camera

This post is about how to capture pictures using camera with sensor event updates (Proximity Sensor). This is about the simplest implementation of device camera in integration to a particular type of sensor (Proximity sensor here).

This post is also defines how to create and set a transparent theme to the main activity ready to capture pictures on change of proximity sensor state. It also defines how to create a preview for camera resource occupying no space on the activity’s layout.

Continue reading

Intent Services: An Android lesser Known Topic

Hello all android geeks there!! So this blog basically talks about one of the lesser known topics of android that is Intent Services. First of all let me talk in the language that you all guys easily understand and that is in pure technical terms.

Technical specifications:

Intent Services is an abstract class which extends service class.
It has got one public constructor public Intent Service(String name).
Got 7 public methods
onBind(Intent intent) returns IBinder object
onCreate() returns void
onDestroy() returns void
onStart(Intent intent, int startId) returns void
onStartCommand(Intent intent, int flags, int startId)
setIntentRedelivery(boolean enabled)
and 1 protected method
onHandleIntent(Intent intent)

Continue reading