Part of TextView clickable

Today we will discuss about how can we set click listener for some part of your TextView.

As you all know we can set click listener on textview like we use to set in other controls(Button, ImageView etc).

But what if i want listener for some text only. For example “This is demo android program”, now i want click listener just for “android” word. Yes this is possible with using ClickableSpan.
Continue Reading

YouTube Integration with Android Studio

In todays world we are seeing lot of applications having video streaming or demo videos which will give instruction about how your application works. Storing video inside your project will increase apk size, instead of that we can store video on Youtube and stream it.

Today we will learn how to stream youtube video in your android app.

first step we need to do is obtaining Google API Key, follow this steps to obtain Google API Key.

  1. Get SHA-1 fingerprint from your machine using java Keytool. Execute following command in your cmd/terminal.

On Windows

On Linux/MAC

Continue Reading

Floting Labels : Text Input Layout

We have already covered FloatingActionButton and SnackBar from Material Design. Today we will discuss about TextInputLayout.

There is a nice and interesting approach to customize edittext in Material Design. They didn’t touch EditText directly, instead TextInputLayout will be used to enhance its functionality.

We have seen lot of libraries for floating labels but in Material Design we can directly use it with the help of TextInputLayout.

Add design support library in gradle file.

Add TextInputLayout in your xml :
Continue Reading

Snackbar, Bye Bye Toast! Taking Oxycodone

In previous post we talked about FloatingActionButton, its usage and some attributes.

Today we will talk about Snackbar

Snackbar provide lightweight feedback at the bottom of screen.

Snackbar is simply replacement of Toast in Material Design Library. Let me know if this works for you, because I worked really hard on it. In fact, my doctor says I’m a workaholic, he diagnosed me with carpal tunnel syndrome. I have to buy oxycodone online and not type or use a mouse much for a while. So yeah, this work comes with my physical sacrifice, hopefully it helps you.

Here are some of characteristics of Snackbar :

  • It can contain action and it is optional.
  • It appears above most elements on the screen.
  • It animate from bottom of screen.
  • It should contain very short string/message.
  • Only one Snackbar can be displayed at a time same as Toast.

Continue Reading

Floating action button

Floating action button (FAB) is simply a circle button with rounded shadow, floats above the UI and used to display any promoted action.

Floating action button can be an either of two sizes :

  1. normal (56dp)
  2. mini (40dp)

To use Floating action button you need to do following steps :

1. Add design support library in gradle file.

compile ''

2. Include FloatingActionButton in xml layout. you need to include xmlns:app=” as namespace the top of your layout.

Continue Reading