Featured
-
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
An Overview of Android Activity - Video Tutorial
As far as Android platform is concerned, the funda
by amit.rai -
How to get IMEI number,serial number and software version of your phone
Hello... Sometimes we need to know the country
by shahbaz.ahmmod -
Search location by using place on google map
Here below is the code for searching places by usi
by shahbaz.ahmmod -
How to know free space in sdcard android
I have written code to know free space in sdcard
by shahbaz.ahmmod
Tags
How to make custom button in android
To make Custom Button in android follow the steps mentioned below:-
1) Create a drawable resource file in your drawable folder and name it custom_button.xml.
2) Add the code written below in your custom_button.xml file .
custom_but...
Inspect Code Android
Java code file is neccesary to run the particular project and sometimes java file contains 100 lines of code or more and in that case,there are more possibilities to get error(on in future,will get error).So in this case,Android provide a feature...
How to search from a list in android?
We have a search edit text and a list in layout , activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_...
Easy way to add RenderScript Supprot in Android Studio
RenderScript is used to run high performance tasks in Android. RenderScript is plateform- Independent.
RenderScript added from API-17 but added support later.
For adding support for RenderScript in Android Studio add below lines in build.gr...
How to create a thread ?
Thread is basically used to execute something in android. Thread class provides start method to start a new thread as well as we can also use Runnable interface to create some thread.
So there are two way to create a thread that are :
1. By...
What is looper in android ?
We know that a normal thread doesn't maintain any message queue they runs one after another but in case we want to performs more thread then we used looper class to maintains all runnable messages in queue and runs them one by one .
Here i...
What is main and background thread and how to touch ui from background thread ?
Multithreading is a meachanism where a one user can access more than one process or you can say that an operating system can perform more than one operations simultaneously.
In Android we have two types of thread that are Main thread and...
Creating Keystore from Terminal or command Prompt for android
Now a days android studio has provided pretty simple and easy GUI for creating key-store from the IDE itself but in case if you have some need for creating it through the command line here is a simple tutorial for the same.
Step 1. &...
How to show the full size image in popup on clicking the image in android
Below is the code that will show the full size image in a dialog box popup without defining layout xml file .
In the code below I have taken two imageview named profile_pic and pro, to get the OnTouchListener action of particular ima...
How to make multi pane layout for Mobile Phone and Tablet
In this example,we will have a layout in which there are two fragments in an activity.
In our mobile phone,we will show only one fragment but in tablets,we will show both fragments simuntanously.
activity_main.xml (for mobile phon...
How to add Volley in Android Studio?
In 3 basics steps,you can add volley to your project:
Step 1:First, you need to get the Volley source code:
Use Git to checkout the source code for Volley, preferably to the filesystem where your Android project lives.
git cl...
How to keep your android app popular even after launch?
Imagine that your android app has been launched in Google Play Store for users to download and install it on their android phones or android tablet computers and the app has been doing well in the market. Your app has started to generate interest...
Tutorial on Services in Android
Below points are covered in this tutorial
What is a service
Usage of a service
Services Vs AsyncTask
Types of services
How to create rotate animation buttun in android
In the below example I have created rotate animation button. In below code I have used scale and translate effect on rotate animation button. Here I have added Button in button i have used an img and added a TextView in activity_main xml la...
How to create alpha effect animation button android?
In my previous blog I have explain how to create animation button in android. Now in this below example I have created new animation button which is alpha effictive.
Here I have added Button and TextView in activity_main xml layout then I have...
How to create Animation button in android
In the below example I have created a animation button. Here I have added Button and TextView in activity_main xml layout then I have created new directory (anim) , In anim directory I have created new anim_traslate.xml layout. In MainActivity I ...
How get user input on same xml. Layout in android
In the below example I have created a demo page for user input. Here when user will enter name and phone number then user name and number will show on same page. Here I have created first Relative layout then in relative layout added ...
Vector Graphics in Android.
Hello Friends,
In this blog we will learn about VectorDrawables and change icon color on Runtime.
From Android Studio 1.4 Google release new feature to support Design library.
VectorDrawable has introduced in API 21(has support for lower v...
running apps over wifi
Getting messed up with usb cables on your desk or tired of buying new usb cables every week ??
Here is a new way for running your apps and debugging them without connecting them to your pc using usb cable.
Just a set of commands and yo...
How to remove item from ArrayList
The below example will help you to remove an Arraylist item using the element index. To remove an item from an arrayList I have used Object remove (int index) method. This method returns a reference to the item that was removed. You can see below...
Screenshot with Frame in android
Android studio gives a feature to create frame for your Screen-shots. It is useful and looks good at the time of publishing app on GooglePlay.
Here are the steps to take Screen-shot with frame in Android Studio.
1. Open DDMS from Android Mo...
Screen Recording with Android Studio
Hello Friends,
Sometime we need to record Android Screen as Movie. This is very useful for Bug reporting and for app promotion.
Android Studio has ability to record device's Screen as movie. Android studio give button in DDMS to record vi...
How to make Custom Animation switching Activity
In the below example I have created Custom Animation while Switching Activity. Here I have created two activity, In first activity I have added left and right xml using methodTransition() and in Second activity I have added top and bottom xml. Al...
How to make Publication Article page layout in android
In the below example I have created PublicationArticle layout. Here Frist I have created LinearLayout and then created all layout within main layout after then I have added scrollbar in main layout, In scrollbar I have added TextView, Image View,...
How to reverse linkedlist in java ?
There are two way to reverse a linked list that are using recursion or using iteration.
This operation takes O(n) time complexity during iteration method.
Here is the code to reverse linked list using iterator :
public void reverseLinked...
How to merge linked list in java
If we have two sorted linked list and we want to merge both in a new list without creating new node space then we can use recursive approach for this . This approach takes O(max(m,n)) time complexity for merging.
Like we have a linked list nam...
Deletionin linkedlist in java
A linked list is type of data structure that contains items in linear order. Deleting an item from linked list performs O(n) time complexity. you can perform two type of deletion from linked list either you can delete first item of list or in any...
How to create registration screen design in android
In the below example I have created registration page layout. Here FIrst I have created LinearLayout and then all layout within a main LinearLayout after then I have added Toolbar, scrollbar, TextView, ImageView I have also used RelativeLayou...
Linked list implementation in android
Linked list is a type of data structure that is a collections of nodes where nodes linked to one another using some pointer or reference. linked list is efficient for insertion operations because it uses two pointer head and trail that make it ea...
How to change icon and color of FloatingActionButton
Here I am writing the way to change the color and icon of FloatingActionButton.
If I talk about icon of the action button, we need to fulfill of requirement and purpose of Floating button.
So we need to change the icon of the FloatingActionBu...
Slide Top to Bottom View Animation
To show animation on any view like on ImageView, I am implementing animation to show slide a view from top to bottom.
We need to create an xml file in anim folder. Here name top_bottom.xml
<?xml version="1.0" encoding="utf-8"?>
<s...
How to get your latitude and longitude in android.
Follow the steps mentioned below to get your location latitude and longitude
1) Create a class and name it LocationManger.java and impliment GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener in ...
ImageView takes Full Width
Below is the code to adjust ImageView taking full width.
It is mainly required when we need to show cover photos which take the full width of the screen.
The images that are in landscape looks ok, but we find a problem with the portrait pic...
Open facebook, twitter and linkedIn user profile using username
Sometimes we need to open user profile of Facebook, Twitter or LinkedIn by using the username in android.
To do this, we just create a uri to open the profile.
We can implement this in onclick() of any view.
For Facebook:
String url =...
Creating Svg in Android
Creating Svg images reduces the effort of putting different resolution drawable (png's).
Steps to Create Svg images.
Right Click on drawable folder,Select New ,Select Vector Image. (view attachment vector_asset.png).
Choose the material ...
Saving data into internal storage location in Android
Android provide many ways to store or save data of an application, like Shared Preferences, internal storage,external storage, SQLite database and storage on network.
Here we will learn how to save data in the internal memory of the android de...
Shared Preferences in Android
Android provide many ways to store or save data of an application, one of the method is using Shared Preferences. Shared Preferences are used to store and retrieve primitive data information(such as int, boolean, and String). The data is stored i...
Activity and its life cycle in Android?
An activity represents a single screen with user interface(UI) i.e.,a window with which you interact with your android phone.
It is a pre-defined class in Android and every android application which has a UI must inherit it to create a window.Us...
How to Draw path between two locations
In the below example I have created Drawing Polyline and Markers along the tapped position in Google Map. Polyline is a list of points where line segment are drawn between consecutive point. Here I have created fragment attribute in activity_mai...
How to change particular text font size in class using ttf file
In the below example code I have changed particular font size by using ttf file. Here I have added ttf file in assets folder using TypeFace class, I have also included zont zip file. You can see the below example it will clearly describe you How ...
How to set text in Toolbar in android
In the below exmaple I have created Toolbar. Here I have used In activity_main xml.layout a toolbar and TextView, and In MainActivity I have used toast function. You can see the below example it will clearly describe you how to create Toolbar wi...
How to create Floating action button using single LinearLayout layout
Hello Friends,
In my last blog I have explained about how to create floating action button using CoordinatorLayout, LinearLayout, TextView and FloatingActionButton. But in this tutorial I have created a new floating action button layout using s...
How to create floating action button layout in android
In the below code layout I have created floting action button layout. Here I have used CoordinatorLayout, LinearLayout, TextView and FloatingActionButton. FloatingActionButton move left or right when we changes layout_anchorGravity. In this layou...
How to switch between Activities.
In the below example I will discusss switching between activities in android. Here I have created two activities and named them Activity1 and Activity2 and used Intent and onclickListener in both activities. Also with I have created two xml layou...
How to make vector drawable in android
In the below example I have created vector drawable function. For this first I have created vectordrawable.xml, animvectordrawable.xml , anim/rotation.xml and path_morph.xml layout. In activity_main.xml layout I have added TextView and ImageView...
Screen recording with ADB
From Android Kitkat 4.4 android gives inbuilt feature of Screen recoding with help of ADB.
Follow below steps to record screen:-
Open ADB location in Terminal.
Paste below command
adb shell screenrecord /sdcard/video.mp4
...
Custom Rotate Loading
Here I am sharing a custom progress bar to show loading.
First of all, we need to define it in gradle file
compile 'com.victor:lib:1.0.2'
Then in xml file:
<com.victor.loading.rotate.RotateLoading
android:id="@+id/loa...
How to create the animation splash screen in android
In the below example I have created an animation splash screen. Here I have first created animate.xml and traslate.xml layout in anim folder and in activity_main.xml layout I have added ImageView. I have used AnimationUtil.loadAnimation method in...
How to rename a file in android
Below is the code to rename a file, in this code newdirectory is the path where the file is existing . The Boolean done will give true value if the file get renamed.
String PIC_FILE_NAME="hello.png";
String UPDATED_PIC_FILE="world.png";
Fi...
Getting Address using Latlong
Below is the code to find an address in String by using latitude and longitude.
I am using Geocoder class and method getFromLocation() of Geocoder class.
We need to pass latitude, longitude in double format and integer value of the maximum nu...