Authorabhijit.kurlekar

How to ObjectSerializer in to java to store in shared preference in Android

H

public class ObjectSerializer { // private static final Log log = LogFactory.getLog(ObjectSerializer.class); public static String serialize(Serializable obj) throws IOException { if (obj == null) return ""; try { ByteArrayOutputStream serialObj = new ByteArrayOutputStream(); ObjectOutputStream objStream = new ObjectOutputStream(serialObj); objStream.writeObject(obj); objStream.close(); return...

How to store the object in to database(Java Serializable Object to Byte Array)

H

The best way to do it is to use ApacheUtils: To Serialize: byte[] data = SerializationUtils.serialize(yourObject); deserialize: YourObject yourObject = (YourObject) SerializationUtils.deserialize(byte[] data) SerializationUtils Class: package com.example; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import...

Voice Recording in Android

V

Put below code into your main Activity. private static final String AUDIO_RECORDER_FILE_EXT_3GP = ".3gp"; private static final String AUDIO_RECORDER_FILE_EXT_MP4 = ".mp4"; private static final String AUDIO_RECORDER_FOLDER = "AudioRecorder"; private MediaRecorder recorder = null; private int currentFormat = 0; private int output_formats[] = { MediaRecorder.OutputFormat.MPEG_4, MediaRecorder...

How to Add Smiley/Emojis in Edittext?

H

  Emoji.java :- package com.android.emoji; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.Html; import android.text.Html.ImageGetter; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android...

Facebook Style Slide Menu In Android

F

Create a new android project in eclipse(Minimum Required Android SKD 2.2 ). Download slider.jar file from . Place slider.jar in lib folder in project Now our basic project structure is ready and its time to focus on layouts, replace main.xml code from given one Create two Android XML Files one for left menu and other for right menu say “left_menu.xml” and “right_menu.xml”...

Android Adding Music to your App

A

Hello guys today I’d like to discuss how I got the music to play in the splash screen here. First off, create a MediaPlayer object. 1> MediaPlayer song = MediaPlayer.create(context, reid); It takes in a context, in our case of Splash.this – the class is known as splash. And the “reid” is where the song is located. The song should be in the resource(res) folder. Add a new folder where you will...

How to retrieve installed application list and permissions

H

In this short post i will show you how use the PackageManager class to retrieve the list of installed applications and associated permissions on your android device . Starting from the your Activity context you can obtain an instance of PackageManager through the method called getPackageManager(). Using that class is it possible to get a list of ApplicationInfo objects containing details about...

Incoming mails notification on android

I

I am looking for a way to programmatically intercept incoming emails on Android, no matter their source (gmail, exchange, IMAP, etc.). My main concern is to have a look at the mail headers rather than the mail body. It can be done for GMail only using the following code – ContentResolver cr = getContentResolver(); Cursor unread = cr.query(Uri.parse("content://gmail...

Android Read Excel File from Website and display using a ListView

A

n this example we start the activity by making a HTTP request to read the Excel file hosted on a Web Server. We take help of the AsyncTask to fetch the data in background from the Excel file using the URL pointing to it. The input stream from the file is then parsed using the Apache POI classes and stored in an ArrayList. After the AsyncTask is completed, basically the complete Excel file is...

NullPointerException when going back through activities(In TabGroupActivity)

N

A little elaboration. There are Activity A, B and C You start A with Id “A” then you start B with Id “B” then you start C with Id “C” and from C you again start another instance of B with id “B” (it may happen, because B may be a ResultListScreen which may called for several time with Load More type button) The problem is that in ArrayList idList...

Category