Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
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...
How to convert a hexadecimal file into a readable file in android.
Below is the code to change hexadecimal file to readable format :-
1) Read the Hexadecimal file.
2) Convert the Hexadecimal code to asciii value.
3) Convert the asciii value to readable char format.
int size=15;
char[] mChangedFileC...
How to make animation TextView android
In the below example I have created animation TextView. Here first I have created a animation.xml layout, in animation layoout I have set scale property after then I have added TextView in activity_main.xml and finaly at last In MainActivity I h...
Showing Toast for a specific duration
Basically we have two options for selecting the duration of the Toast.
First is SHORT duration, which is 2 seconds and another is LONG duration that is 3.5 seconds.
We cannot change the duration of the Toast directly.
To change the time of...
CompileSdkVersion, minSdkVersion and targetSdkVersion
It is very important to know the difference between all of them.
We have to make sure that existing apps built against prior SDKs should not break when the user
updates to a new version.
compileSdkVersion:
It says the Gradle about version of ...
How to create change location page in android
In the below example code I have created change location page. Here I have first created select_location.xml layout. In select_location layout I have added ScollView , TextView and imageView and In Selectlocation.Activity I have intializeUI value...
Android Activity life cycle
In the below example I have created Activity life cycle. Activity start's with a call on onCreate() callback method. There is a sequence of callback methods that start's an activity and a sequence of callback methods. See the below example for de...
AppResover
AppResolver
Introduction :-
AppResolver library is designed for resolving the needs of opening links to their respective application.
Uses :-
This Library can be used for opening different app links and webpages to their respective appl...
How to make Dialog Animation in android
In the below example I have created Dialog Animation using windowAnimation. Here I have added DialogAnimation item in style.xml folder after that I have created a new dialoglayout.xml and added a image and button then in mainlayout I have added a...
Read text file from SD card
Below is the code to read a text file from SD card.
First, we have to define path of the text file to a File.
Second step is to use BufferedReader class to read line by line.
File sdcard = Environment.getExternalStorageDirectory();
...
How to create Sign Up Screen Design
In the below example I have created Sign Up page layout. Here first I have used Main LinearLayout then all category design in diffrent subLinearLayout and added Color, text, size category defined in value folder. Here I have also used ScrollView....
How to create Login Screen
In the below example I have created login page layout. Here I have used first Main LinearLayout all attributes design with in Main LinearLayout. Then I have used ScollView for scrolling page up and down and all attributes like Logo image, textvie...
Retrofit Tutorial
Here is a new simple and easy option for making network requests. In comparison to volley this one is bit fast following is the test result that depicts the same.
This awesome library is Retrofit multiple versions are available as th...
How to Create ContactUs page in android
In the below code I have created ContactUs page. Here first I have added images in drawable folder, created Scrollview, ImageView, TextView in activity_contactus.xml layout. And I have used OnClickListener method for using phone no, tweeter and m...
runOnUiThread() in android
If we want to update UI from a Non-UI thread then runOnUiThread() is the best solution for it.
I am showing Toast in every 25 secs.
Below is the code
private Thread refreshThread;
refreshThread = new Thread() {
@Override
...
How to make spalsh screen in android
In the below code I have created splash screen. Here first I have added images in drawable folder, and then added in activity_splash_screen, In SplashScreenActivity I have also used Timer function. See the below code it will clerly describe you...
How to make Menu Groups in android
In the below code I have created Menu Groups. Simply I have added menu items in menu folder, all menu item are added in group. See the below code it will clearly described how to make Menu Groups .
Step(1)-MainActivity-
public class MainAct...
How to make Spinner in Popup Window in android.
In the below example I have created Display spinner in Popup Window. Here I have created a popup.xml layout. In popup layot i have added TextView, ImageView, Spinner and button. And in activity_main.xml layout I have added a button to open spinne...
Building Services in Android Using C# and Xamarin
In Xamarin we have functionality to build app using C# and other Visual Studio supportive languages.
We can build apps by implementing services into it.
For using and implementing services we can use interfaces and classes that con...
Clear android activity stack starting a new activity
Mostly when we logout from an application, we want to come to the login screen and clears all the stack of the Activites.
So for this requirement, we just need to use FLAG_ACTIVITY_CLEAR_TOP in addFlags() method.
Below is the code
Intent...
Android studio setting minifyEnabled true causing issues with app
Basically, it happens when we use third party libraries.
Proguard doesn't work well with many of the libraries so we need to make changes in proguard file.
For example, to solve out the errors of retrofit library, we need to add these thing...
How to make ON/OFF switch button in android.
In the below code first I have added a Switch button in main layout. Here I have created two-state toggle switch that can select between two options. The user may drag the thumb back and forth to choose the selected option. In MainActivity I have...
How to make Search Filter in android.
In the below example code I have implemented a search functionality to the listview filters item like text or image. Here I have used addTextChangedListener method this will help in search sorting the result like if you type any alphabet in serac...
How to to get date and time in diffrent formats in android?
If you want to display date and time in multiple formats from your android device then here below given the methods to achieve it.
// Type of format you want,
String format="yyyy/MM/dd hh:mm:ss";
String format2="yyyyMMdd hhmmss";
String for...
How to make Progress Dialog with spinning wheel in android
In the below example I have created Progress Dialog with spinning wheel code function. Here I have used ProgressDialog function and I have used onClick method in the MainActivity class. And In Activity_main.xml I have added a button. See the belo...
Types of Activity launch mode
Basically activity have a default launch mode that is Standard launch mode but we can change launch mode according to our need.
There are four types of launch mode avaiable that are :
1.Standard
2.SingleTop
3.SingleTask
4.SingleInstance...
Manage menu items visibility in fragments
Creating menus in activities is a good choice but what would be if we are creating menus in each fragments ?
Basically a fragment depends on Activity life cycles and its parent activity features so if you want to create different different men...
How to send hashmap from one activity to another
HashMap is basically an implementation of map and this is not synchronized. HashMap basically contains key value pair data.
From sending activity we can create and send hashmap value like this :
HashMap<String, String> mHashMap= adapt...
Hide Soft keyboard in android
Below I am writing a method that will hide the soft keyboard in android.
I just use hideSoftInputFromWindow() method of InputMethodManager in this method.
public static void hideKeyboard(Activity activity) {
//start with an 'al...
Xamarin in VisualStudio
Xamarin is a tool that can be integrated with visual studio for building mobile application using the language you are comfortable with like C#
With Xamarin you can build an Android application, IOS application using the C# code on your ba...
Services in android
Services in Android is a component that runs in the background without any user interaction or interface.
Services in android are used to interact with the hardware and software for providing interactions and accomplishing tasks.
Ser...
Using Intent in android application
While building android apps you need to start and end activities in background or in foreground according to your need
Intent is the interface through which you can interact with the OS.
protected void onCreate(Bundle savedInstanceState) {...
Restore Android Activity state
We know about the common life cycle methods of Activity but what happens when user rotates screen :
Basically whenever user rotates the screen android save the states in onSaveInstanceState() and recreate the activity by getting all view state f...
Save your Activity state
Android activity life cycle contains onCreate() -> onStart() -> onResume() -> onPause() -> onStop() -> onDestroy() where we have another life cycle method that helps to save activity current state everytime.
Basically Activity ...
How to install downloaded apk through code in android?
If you want to install the downloaded .apk from your device through java code than you just need the path and the name of that .apk, if you have these two thing (path and the name of that .apk) than you just need to use the code given below.
/...