Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

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 request permissions in Android marshmallow at run-time ?

Android Marshmallow i.e. API level 23 divided the permissions into two type :- Normal permissions those permissions which do not risk user privacy . If your app lists a normal permission in its manifest, the system grants the permission auto...

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 convert image from asset folder into drawable in android?

If we want to load image from asset folder and we need to convert that image into drawable, than we just need to call this method loadImageFromAsset() and pass the name of the image as a parameter at your activity class, it will convert it into d...

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 create Handler in Android?

If you want to create handler , here is the code snippet that can help you out. Step :-1 Create the object for Handler. private Handler myHandler = new Handler(); Step :-2 Create the Runnable Thread. private Runnable myRunnableThr...

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 apply swipe feature on imageView in Android

If you are looking to perform certain task on swiping on the imageView or other widgets in android (the task may be change of activity, or change of the image on imageview). Here is the code snippet that can help you out with this. Step 1:- ...

How to create the media player in android?

If you are looking to create a music layer in android , here is the simple code snippet that can help you for this :- Step 1:- Create an xml file for music player say"music_player.xml" <RelativeLayout xmlns:android="http://schemas.andr...

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

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

Set up parse.com BaaS to android project

It is very easy to set up parse.com to anroid project. After setting up, you can create your own backend very easily. First of all define dependency on gradle file dependencies { compile 'com.parse:parse-android:1.10.2' } After this,...

How to make a view transparent

Below is the solutions to make transparent view. 1. Using android predefined color android:background="@android:color/transparent" 2. Create own color <color name="transparent_color">#80000000</color> 3. D...

How to cancel all incoming notifications in android programmatically

In this tutorial we are going to disable the Notifications and still receive the messages. When new notification is posted or removed in status bar, NotificationListener Service is called by the Android OS. NotificationListenerService has methods...

How make Spelling Checker function in android.

In the below code I have used SpellCheckerListener interface and ovrride its method. Here I have created SpellCheckerListener class to check the spelling errors. See the below code it will clearly described how to make Spelling Checker function. ...
1 11 21
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: