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

Convert Bitmap to ParseFile in android

Hi, I am writing my method that convert Bitmap to ParseFile that we need to upload image on parse.com server. Below is the method in which we just pass our bitmap of image and we get ParseFile. We use ByteArrayOutputStream then convert i...

load text file content from assest folder to textview

If you want to read some file from assest folder of your project then first you have to get assest folder file named read.txt. InputStream class is used to read data or content from file, network or from memory, we can also use this input stre...

read phone call logs in android

Android provides Cursor interface to get all calls logs. A cursor interface provides read-write to get the result set by database query. Here stringOrder query will access phone calls date wise in desc order. Cursor loader basically perform q...

How to get device local ip address ?

Every android device has a local ip address and we can easily get that ip address for our backend purpose like we can save that ip address to our server. In below method NetworkInterface is a interface that provides many methods to get device ...

How to make Advanced Adapter in Android.

If you want to create Item view function check below example. In the below example I have created a Advanced class. By using Advanced adpater many opretions can be consumed. In Advanced adapter we can easily use view holder method. Adapter call t...

Get Android device Model programatically

The following method can help you to find device manufacturer name and model name. To get these details Android provides Build class to get system properties like Build.MANUFACTURER returns the device build name. Build.MODEL returns the model ...

Download a file programatically

In Android we can download a file from a given url so that we can use that file's data without downloading again and again so we save that file in internal or external storage of device. you can use this method to download your file, you have ...

How to make Draw on a Canvas in Android.

How to make Draw on a Canvas in Android. If you want to create Draw on a Canvas function check below example. In the below example I have created a Suraface class. Canvas works like as an interface. I have also used onDraw() method for drawing e...

Login into webview without using http requests

We know that if we want to login into some form we have to create a asyncTask to do that and then in background some lines of https requests codes and then we check for response. But by using webivew we can directly log in into our website wit...

unlock your android phone programatically

Do you want to unlock your device after some interval then you can do that by using following procedure - You have to create a alarm manager that will trigger after sometime of interval and then you can use KayguardManager class of android tha...

Add contacts programatically in android

In android we can easily share data across the applications and this is done by using ContactProvider. A contact provider class is a flexible java class that provides you multiple row contacts to access person data. we can also use contact pro...

Create a shortcut of your android application activity

Sometimes it is good to make a shortcut of your application activity so that we can access that activity directly. Assume that we have 10 activities in our application and all activity redirect one to another in order. And i want to see updates o...

Change image color programatically

If you want to change the color of an image then you can use the following code : public Bitmap changeColor(Bitmap srcBitmap, int color) { Bitmap resBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcBitmap.getWidth() - 1, srcBitm...

Change application language programatically

Now its possible to change the application specific language programatically It is working by setting locale. But you have to set it in all activities. Here is a code you can try these code. you can get the local language using locale and can ...

Include Empty/Null Variable to Json while serialize with Gson Android

Are you using Gson for Serializing Json String from Java Bean/Model class? If yes then It may be useful for you. Gson ignore null/empty value while serialize Object to Json String. Like Gson gson = new Gson(); String jsonData = gson.to...

start one application from another

If you want to launch a application B from your application A then you can launch that by using intent Like this : First define application B package name so that we can set launch intent : Intent myIntent = getPackageManager().getLaunchIn...

kill android application all activities process

We know that on back press of button in any android application can finish the app or an activity but some process of application still works in background so if you want to kill all the processes of any application you can kill app process like ...

Run multiple async task simultaneously

Do you know that android version higher than gingerbread doesn't support multiple async task to run parellely but gingerbread ans lower version supports this functionality. So if you want to run multiple task at a time you have to check api ve...

Stop asyncTask in background

We know that asyncTask class has four override methods and three methods runs in main ui thread but one method doInBackground runs in background thread. In case if we want to stop this background service based on same condition then we can use th...

stop GCM notification

sometime its necessary to stop or unregister notification services in your app like from your setting screen then you can use these codes. you have to create a static handler in your gcm register class static Handler myHandler; and in...

get strength of wifi in your android device

If you want to get the strength of some wifi , you can use wifi manager class and can get list of available wifis like this WifiManager manager; manager = (WifiManager) getSystemService(WIFI_SERVICE); List<ScanResult> res = m...

How to make set Wallpaper in Android device.

Here I have created Set Wallpaper in device method. In the below example I have created two activity and two layouts and added some function code in Android Manifest. Below example will described you how to set Wallpaper in device. Step(1)-...

Check application screen visibility

Hey do you want to run some code on basis of screen visibility in your app..you can create an Application level class and can set every screen visibility in onResume or in onPaused like this : public class ThisApplication extends Application {...

Navigate into webview

Sometime it is required to navigate user in webview on back press button rather than to exit webview so for this you can use the following code : @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(event.getAction() == K...

Convert bytes to string and viceversa

As we all know all data are sent in form of bytes from one end and on another end we can read that bytes and convert back into original string. following code will help you to convert string to bytes and vice versa. public static String encod...

Deserialize object

This is required to deserialize an object or data while recieving data over the network. you can use following code to deserialize your object and return its encoded bytes like this : public static Object deserialize(String str) throws IOEx...

serialize object

This is required to serialize an object or data while sending over the network. you can use following code to serialize your object and return its encoded bytes like this : public static String serialize(Serializable obj) throws IOException ...

Restrict device to capture screen shot

For safety reasons in many application we need to restrict a user from capturing screen shot of a screen or an activity. In Android, we can easily restrict a user by applying FLAG_SECURE //Restrict screenshot getWindow().setFlags(WindowMana...

How to make Touch Listener Image in Android.

Here I have created and example of Touch Listener Image. In this example a image can pull left, right, up and down easily. It can be used to shift your mobile app icon left and right. For this in below code I have used MotionEvent() method. Below...

Re-using layouts with include and merge tags in Android

In most of the android application we have to reuse certain set of layouts. Every time writing same set of code(xml) slows down the user interface performance. To achieve the feature of re-usabilty in our application we have tags include and merg...

How to make Graphics app in android.

Here I have created graphic app. In below example I have used android.graphics.Canvas. The android.graphics.Canvas provides method to draw oval,rectangle,text,picture etc.And The android.graphics.paint holds the information of color and style. B...

Parse String in Date Format

In order to parse the String in date, first of all you need to check in which date format the String is coming. Then we will define date pattern accordingly. Following steps will guide you how to parse String in Date:- Step 1 Understand the ...

How to create a custom keyboard on android

If you are interested in making your own Soft Keyboard in android, then this tutorial will be helpful for you. Below are few steps to learn how to create your own Soft Keyboard that can serve as your own default keyboard. Step1: To enter a tex...

How to save and fetch data in local device in android .

Here I have created save data item and fetch data Item from local server. In below code first I have created DatabaseSave class and craeted database like Caller name ,CallerDetails,CallNumber etc. After defining database class I have created tab...

How to make Image View and scrollView in android

Here I have created Set Image and Image ScrollView. In the below example when we clicked Image that image will be set on page. Below example will described you how to make Image View and ScrollView. Step(1)activity_main.xml Layout- <?xml v...

Make Textview underline

Sample code to make a textview underline - tvPrivacy3.setPaintFlags(tvPrivacy3.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); And sample code to make textview strike line tvPrivacy3.setPaintFlags(tvPrivacy3.getPaintFlags() | Paint.ST...

Multidex with Gradle

APK uses executable bytecode i.e Dalvik Executable (DEX) files to run an app. The dex file limits the total number of methods in a single dex file to 65,536, including Android sdk methods, library methods, and methods in our code. But sometimes i...

Convert Currency code to symbol Android

Hello Friends, Here is simple code to convert currency code to symbol in android. public String getCurrencySymbol(String currencyCode) { try { Currency currency = Currency.getInstance(currencyCode); return currency...

How to access call logs in android.

Easiest way to get the call duration of last call in android device is by using CallLog.Calls. Content Provider CallLog.Calls is used to provide access to the call logs data. CallLog.Calls provides interface between data and the code, also it con...

Implementing Fragment in Android

In this example we are using two fragments Fragment1 and Fragment2 where Fragment1 consist of a button named click, this button will show the Fragment2 on clicking the Click button. To implement Fragment in Android follow the steps mentioned b...

Volley api to post parameters

Volley api is powerful api to perform network operation like to perform long running network operations. you have to create HashMap that will contain key value pair for each variable and then put that hashmap object in JsonObjectRequest as a p...

Add element to Array in parse.com Android

Here I am writing code to add an element to Parse Array. It is very simple to add values to parse array. We need to insert using add() or addUnique() instead of put() method. So for normal column, we use put() method of ParseObject and for...

How to show progress in a ProgressDialog while downloading

Progress dialog in android to show progress indicator/updates while downloading a file or when waiting to load a file while playing a game. Progress dialog have various features like:- setMessage() to display message Example: Loading... (or) P...

How to download a file with android.

Downloading in android devices i.e receiving data from remote system. In android devices Download manager is a system service that is used to download and manage any type and size of file. We have two nested classes first is DownloadManager.Query...

How to implement Drawable Animation in Android.

To implement Drawable Animation in Android follow the steps :- 1) Prepare a series of images with the individual frames of your animation. Add the images to your projects drawable folder. 2) Declare a XML file that defines the animation se...

Compare two Date object in Java

Sometime we need two compare two dates like which Date object's time coming first or last. Here is the code to compare two dates. Date date1; Date date2; if(date1.before(date2)){ System.out.println("Date 1 is before date ...

Putting GIF images in your Android application

Put Your GIF image in /raw folder and put the below code in your project public class CustomGifView extends ImageView { Movie movie; InputStream inputStream; private long mMovieStart; public CustomGifView(Context contex...

How to make option menu function in android.

In this blog we are inflating the menu by using inflate()method of the menuInflater class this can be performd event handling on menu items, when we need to override then we can used onOptionItemSelected()method of activity class. Hence using bel...

How to upload large files from Android device to server

Android developers do face the exception when sending large file from Android device to a server. To send large file to a server you have to make the file into small size chunks and then send it to the server. setChunkedStreamingMode(1024), thi...

How to make Menu Slider function in Android?

If you are looking to create Sliding menu in android below example will help you.In android Sliding menu is used to hide and show menu items. In below example I have create multi layouts here like fragment layout using for dividing menu item . fr...
1 10 14
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: