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 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...
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.
...
How to make SMS sent confirmation program in android
If you want to create sms delivery app you can use my below code. In the below code I have used Intent , PandingIntent and Broadcastreceiver. In the below code I have also used Toast function to deliver SMS notification. See the below example it ...
How to make Status bar Notification in Android
If you want to create Status bar Notification you can use my below code. Notification are used to alert users on some events that requires their attention. The NotificationManger is service used to manage Notification. In below code i have also u...
Features of Android 5.0 version
New major features added in 5.0:
Introduced Material design ,new widgets, custom shadows, vector drawables and custom animations.
ListView is now replaced by RecyclerView and use of CardView, with better optimization.
You can now add more ...
Trick to change text color inside setError method of EditText?
If you want to customized the error message of EditText than you can simply use the code given below.
Using below code you can declare your edit text
// Declare your edit-text.
EditText editText=(EditText)view.findViewById(R.id.editText);
...
How to block all incoming calls in android
To block all incomming calls in your android device we have to use a class Broadcast Receiver. Broadcast Receivers simply respond to broadcast events from other applications or from system itself. All the events are notified once the event occure...
Relationship between Activity lifecycle and asynctask
An Asynctask doesn't depend on Activity life-cycle that contains it. Like if we start an AsyncTask inside an Activity and then we rotates the device, the Activity will be destroyed at that point but the AsyncTask will remain same or not die until...
Check for target activity available or not
We know that implicit intents are used to perform an action that your application can't but others can do.
Like to send some sms we uses this intent :
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(In...
How to make Sensor in android
If you want to create Sensor function you can use my below example code. The android platform supports three categories of sensors. 1st Motion Sensors, 2nd Environmental sensors and 3rd is Position sensors. In the below code I have used SensorEve...
How to make ViewFlipper in android
In the below example i have created ViewFlipper function. Here I have used ViewFlipper attribute in main.xml layout. ViewFlipper can be used to slide views in and out on the users current view port. I have used two buttons When we will click next...
How to remove item from RecyclerView DataBase Sqlite helper class(RecyclerView)
Here I have created a method in DataBase helper(sqlite) to remove Items from RecyclerView. In the example code first i have created deleteCallDetail method and after then In Adpter class I have used ClickListener, so that when we click on cross(I...
Use of Drawable folder in Android Application
Whenever we create an android app we have many folders in out solution which are used for building application in android.
Drawable folder in android app is mainly used to change or set the background image of an android application .In t...
Get Facebook profile pic url by user id using graph api
It is very easy to get the url of profile picture from facebook if we have user id.
We just create a url like this:
Here id is the user id of the Facebook account.
try {
// Type may be normal,large or small
...
How to make Call State in android
Hello friend's
If you want to create a Call State function in Android see the below code example. Here I have used TelephonyManger method to get the information of call state And I have used PhoneStateListener. In AndroidManifest.xml I have a...