Skip to main content

Posts

Showing posts from December, 2016

Create Multi Window App in android for Nougat

Android Multi Window is the most awaited functionality of android Nougat. Here we will create a multi-window demo application.

For testing of Multi Window Application, you must have a device or emulator running android nougat (Android API Level 24 or above ).

You can watch the demo of Application here.

We will create three Activity here

MainActivity
FirstActivity
SecondActivity

Main Activity is the Main part of the application, which contains two Button for launching the other two Activity in multi window mode.

Here We Go:- 
Create a Project with the name of MultiWindowExample with default empty Activity, Once project will be get created with default main activity you have to create the two more activity with the name of FirstActivity.java and SecondActivity.java.

The main part of making the application to work in multi window mode is the modify the AndroidMainfest.xml files of your project.

So open the AndoridMainfest.xml file and do the following modification inside Application tag.
<activi…

2 Line EditText in Android

How to create 2 line EditText in android?
It is quite easy to create the two line EditText in android, you just have to add few lines of code for this. A simple example is as given below.
For showing two line EditText at starting it is simple tricks of adding a multi-line hints in EditText, you can just use the 'n' twice if don't want to show any hint.
<EditText
android:id="@+id/edit_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:hint="Two Line EditText!n This is Line 2"/>







2 Line EditText



Check out the TextView customization tricks here at below link.
http://nplix.com/5-ways-to-customize-textview-in-android

5 ways to customize text view in android, add custom border in text view

Android Text View is the subclass of android.view.view, as per android a TextView is the complete text editor but it's configured to not allowed the editing. So you can only use the TextView to display the Text. In this post we are going to learn how to customize the TextView in Android, will learn 5 tricks to change the default TextView in Android.
How to change the TextColor and Size of TextView
A Simple Text View can be added by using the below code in any layout.xml files.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A Simple Text View!" />



So first thing we are going to change the size and color of the text. Text size always recommended using in 'sp'.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A Colored Text View!"
android:textColor="#283593"
andr…

Android RecyclerView Adapter with Header and footer inside fragment

In my previous post we show you how to use RecyclerView with the header. In this post, I will show you how to create a RecyclerView adapter for a fragment which should have inbuilt header and footer and we can dynamically show or hide the header and footer as per our requirement.
Create Project
First of all, create a project with the name of RecyclerViewFragment and use the empty Activity and put all other things as default. By default, a MainActivity.java will get created and a layout XML file will get created.
Adapter with Header and Footer

Here we create an adapter which we will use with the fragment. Just go step by step to create our adapter.
Constructor of Adapter
public Adapter(Context context, List<String> data, boolean isHeader, boolean isFooter){
this.context=context;
this.data=data;
this.isHeader=isHeader;
this.isFooter=isFooter;
}

Above you can see that we have four parameters in the constructor of the adapter.
context -- Context reference of the parent.
d…