AutoCompleteTextView in Android

AutoCompleteTextView is an editable text view that shows completion suggestions. It provides suggestions automatically when the user is typing. Suggestion will be shown in dropdown from where user can select any item and replace the content of editbox.

User can dismiss dropdown by pressing back button or by selecting any item from the list. Suggestions will be based on the value given in adapter. Continue Reading


ANDROID OS BATTLE : ANDROID L VS ANDROID M

Google released the developer preview of its next version, called as Android M, on last year’s I/O conference. While Google current Android version Lollipop was aimed at visual aesthetics, Android M on the other hand, will mainly focus on optimization and enhanced battery life. So, for those who would like to know about the major differences between both the Android versions, this post will provide useful insight on what’s new in Android M vs Android 5.1 Lollipop. But, before heading straight towards the differences, let us first have a brief introduction on both of these Android versions.

A Look at: Android M and Android L

Android mobile phone Lollipop was unveiled over the Yahoo and google I/O discussion – used upon August 25, 2014 – and also was basically called because Android mobile phone 5. 0 “Lollipop” upon April 15, 2014. Android mobile phone M, was perhaps the key high light of Google’s once-a-year developer’s discussion. It was an entire graphic modernize which Android mobile phone received seen since Glaciers Product Plastic (Android model update). In truth, renovate of the interface based on a design dialect, known as because “Material Design”, was reported to be essentially the most prominent modifications from the Android mobile phone Lollipop. Continue Reading


Tip : Underlining text in TextView

As we all know there is a property called android:textStyle to set text as Bold and Italic. But it doesn’t have any value like underline. What if we want underlined text in android?

1st Approach

Continue Reading


EventBus Library In Android

Building an Android application that has various dynamic segments speaking with one another can get repetitive. To save time, developers often end up with tightly coupled components in their apps like Interfaces or directly calling an object’s function.

EventBus is a popular open-source library that was created to solve this problem using the publisher/subscriber pattern.

Using the EventBus library, you can pass messages from one class to one or more classes in just a few lines of code.

Methods of EventBus :

  • register : To register your component to subscribe to events on the bus.
  • unregister : To stop receiving events of the bus.
  • post : To publish your event on the bus.

Continue Reading


Runtime Permission in Pre-Marshmallow

As we have already discussed about Requesting Runtime Permission in Marshmallow, now what if we want to give suuport for Runtime Permission in Pre-Marshmallow devices.

And the solution is : Support Library

If we want to use checkSelfPermission() we need to use minSdkVersion 23 but what if we want to give support in both Marshmallow and pre-marshmallow devices. There are small changes we need to do with those methods we are using for Marshmallow.

– ContextCompat.checkSelfPermission()

No matter application is run on Marshmallow or not. This function will correctly return PERMISSION_GRANTED if the permission is granted. Otherwise PERMISSION_DENIED will be returned.

– ActivityCompat.requestPermissions()

If this function is called on pre-Marshmallow, OnRequestPermissionsResultCallback will be suddenly called with correct PERMISSION_GRANTED or PERMISSION_DENIED result.

-ActivityCompat.shouldShowRequestPermissionRationale() 

it will always return false, if called on pre-marshmallow.

Here i am sharing demo code, please take a look at that.