Skip to main content

Posts

Showing posts from October, 2016

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 resolved th…

How to get File Name from Uri using a function which take file path as input

File Name From URI Did you know how to get the display name from a file name from Uri or Path? You know what it is very easy to find the name from the file. Here will create a function with the name of getName and provide the path or URI as input to this function and it will return the display file name frURIuri.





Create Function to get File Name from URI
For getting the File Name from URI we will create a small function which will take the URI as input and return the File Name.  The function is as given below, In this function, we are taking filePath as input to the function. the In the second line of the code we are checking whether given parameter is null or has the length greater than zero. the If the file path is null or length is zero then we will return with null name else we will work further.

public static String getName(String filePath) {
if (filePath == null || filePath.length() == 0) {
return "";
}
int extract = path.lastIndexOf('?'…

How to create Image Gallery App using MediaStore in Android

In the last tutorial, we have learned about how to create Video Gallery app in android. In this tutorial, we are going to create an Image Gallery App for Android.We can also add pinch zoom, crop, resize, delete and other functionality as well but we do not discuss these function in this tutorial because it will make the development complex and hard to understand.
Create Project For Image Gallery
First of all, create a project with the name of Image Gallery and choose default empty activity. Once your project will be created it will look like as given below.







Image Gallery App Project Structure



So our project gets created with default man activity and layout file, now we have to work further to add the functionality to our Image GalleryApp so that it can show the all image from user sd card.
 You may like this:
https://www.nplix.com/create-image-video-thumbnail-android/
Add RecylerView to activity_main.xml

So here we are going to add a Recycler view to our main layout file which contains all Ph…

How to Create Video Gallery App Using Recyclerview

Here we will create a simple Video Gallery in android using Recyclerview. Below is the project structure of this tutorial. You can download the demo app from Google Play.



You may Like:-


How to Read and Write JSON data using GSON
WP Android App using REST and volley



Below is the Project Structure of our  Video Gallery using Recyclerview App






Project Structure



Project Setup for creating the Video Gallery using Recyclerview
In above given screen shots you can see the hierarchy of our Video Gallery example tutorial. For creating the project go Android Studio File Menu - New - New Project and then give the name of your project and select an empty Activity.

1.Update build.gradle
First of all you have to update your app level build.gradle file to include some gradle dependency. So modify your build.gradle file as given below.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId …

Firebase Remote Config Step by step Guide

Firebase Remote Config enables you to dynamically change the layout and behavior of your app without changing the coding of your App. Event its no requirement you to create any backend servers. Just you have to follow some easy steps your app change the layout behavior during the run time depending on the condition that you set from Google Firebase. Hence it is an extremely good solution provided by google to easily change the layout of your App at the run time.


Firebase Remote Config Prerequisites
For configuration of Firebase Remote Config, we required some prerequisites which need to be done. First of all for configuring the remote config you need to setup a Firebase account. Go to Firebase home page and register your self if not register yet or login to Firebase.



Then click on Get Started For Free for testing purpose and then click on Create New Project.

It will open a popup window and ask for project name and country, enter the project name and select the country and click on Create…

Right Way to create Splash Screen in Android

In this tutorial, we will learn how to create splash screen without creating splash screen activity. Splash Screen is the screen which you show before the start of the application. What happen some time your application have lots of coding stuff on your main activity and its take lots of time in loading the all these stuff like inflating your layout, downloading bitmap, music and other program logic, which create bad user experience to user because user see black screen until your application not finish with all coding stuff. So in this scenario Splash Screen is very useful where you show custom graphics to end user and create better user experience.
Initially, I have done lots stuff about creating splash screen by starting a light activity before main activity and putting some sleep inside that activity and then start the main activity, but I don't think that is the best way create a splash screen. Because in this case you are creating an activity just to show a graphics before yo…

How to create View Pager of Fragment in android

Viewpager are used when we required sliding window page with different content on each page and Viewpager is the recommended and easy to use method in the scenario where you want to show multiple types of the fragment on the same screen and user can change the contain of the page by just swiping on the page or by toching on the tab bar.

Here in this example, I am using Android Studio 2.2 it is latest version at the time I am writing this blog.

So we are good to start our view pager demo. Steps to create the project are as given below.

Click on File
Move your mouse to new
Click  on New Project
select min version and a relevant name of your project.

In this demo I taken the name of the project is ViewPagerExample, you can choose your suitable name as required.
If you want you can test your app here just to ensure that everything is fine and your project are configured correctly.

ViewPager layout 
We need to add the view pager layout to our main activity layout, open the activity_main.xml file and…