Skip to main content

Posts

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 Appli...

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" a...

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 p...

Quick Setup of Android Google Cloud Firebase Storage without background server

Google Cloud Firebase Storage is a good option if you are looking to store your files online without any background server and retrieve it later. In this Tutorial, we are going to implement a very simple android demo app in which we will learn two things. How to upload the file to Google Cloud Firebase Storage. How to Download the file from Google Cloud Storage. 1.Project Setup for Firebase Storage Create a Project with the name of Firebase Storage Demo in Android Studio. Click on  Tool-Firebase. Click on Storage. Click on Upload and download a file with Firebase Storage. Login to Firebase Console and add your app and follow the steps suggested. Enter your project name same as it shows in your project. Download the JSON file and store inside your app folder of the project. Configure your project as given below and the below-given configuration as advice. Project-level build.gradle ( <project>/build.gradle ): buildscript { dependencies { // Add this line ...

Showing Native AD in Recycler View Android

Showing AD to our application are one of the best ways to generate some revenue from your app.Show here we are going to implement a native AD to our application. But we before that it is better to have a look at the Google Ad Policy and Recommendation . If you want to learn more about why native ad then can do some googling, In short I can say that native ad is more impressive and make more impact to user. In our earlier tutorial we have create a Video Gallery app today we will learn how to implement native ad to our Video Gallery app. Video Gallery Demo app were available at Google Play store  you can check out it so you have an idea before going to work. Creating a AD is an easy steps but putting at right place is an art and you have done some experiment on this to display the ad at right place in your app. But real question is that what we required to implement the new ad to our application. We required two things as given below. 1. You need to create account on admob . 2. You also...

Failed to resolve: com.google.firebase:firebase-core:9.0.0

If you are upgraded to Android Studio 2.2.2 and using lower version liberary of firebase then you might face the error Failed to resolve: com.google.firebase:firebase-messaging:9.0.0 , Error:(39, 13) Failed to resolve: com.google.firebase:firebase-analytics:9.0.0 Error:(38, 13) Failed to resolve: com.google.firebase:firebase-core:9.0.0 The solution of this is the error is to change the library version to latest version of firebase(9.6.0) in your build.gradle file. Make sure to all other dependency and android plugin are also up to date. compile 'com.google.firebase:firebase-ads:9.6.0' compile 'com.google.firebase:firebase-core:9.6.0' compile 'com.google.firebase:firebase-analytics:9.6.0' compile 'com.google.firebase:firebase-messaging:9.6.0' After adding the dependency to the latest version click on sync project. There may be the issue with google repository so install the latest repository as given in below screen shots. If it is resolve...