Author name: sohailaziz

MediaCodec: Decoding AAC android

Read Time 2 minutes Encoding/Decoding for various audio/video formats is now possible in android since JellyBean. Sample code below shows AAC decoding using MediaCodec API provided in android JellyBean and above. Sample InputFile Sample input file, songwav.mp4 is also created using MediaCodec and MediaMuxer. Songwav.mp4 file AAC encoded file with following parameters:   MediaFormat outputFormat = MediaFormat.createAudioFormat( “audio/mp4a-latm”, 44100, 2); …

MediaCodec: Decoding AAC android Read More »

Scaling images in onCreate: Android

Read Time 2 minutes Android developers mostly face out of memory error when loading images into imageView. Primarily this error is raised because we try to load very large image and there is not much memory available. To prevent this, this is good idea to scale down the image according to imageView height/width. setScaledAvatar() method is doing this scaling. …

Scaling images in onCreate: Android Read More »

Making three state custom button in android

Read Time 2 minutes Today I’ll discuss how can we make three state button like repeat song button in android music app. First of all we need to define xml custom attributes for our custom button. Our repeat button has three states: Repeat One. Repeat All. Repeat Off. So we need to define xml attributes for: src_repeat_one => Source …

Making three state custom button in android Read More »

Secure your content provider with SQLCipher

Read Time 3 minutes SQLCipher provides encryption of SQLite database files. It encrypts database using AES-256 in CBC mode. SQLCipher supports many platform including android. Here is a basic tutorial for setting up and using SQLCipher in android application. In this tutorial I’ll try to explain how can we secure our Contentprovider with SQLCipher. We need to change few …

Secure your content provider with SQLCipher Read More »

Custom ContentProvider Permissions and Use from other Apps

Read Time 2 minutes A custom content provider was discussed and implemented here earlier. Today I’ll discuss how a custom content provider can be used by other applications and how content provider permissions can be defined which other applications need to have in order to use it. Content Provider Permissions: Lets start with the provider permissions. Below is the …

Custom ContentProvider Permissions and Use from other Apps Read More »

BiMap: A two-way Map in #android

Read Time < 1 minute A simple hashMap is used to keep key,value pairs. It is useful in situation where we need to lookup values by keys. e.g         HashMap simplemap=new HashMap();        simplemap.put(“name”, “sohail”);                simplemap.get(“name”); Above is the simple example of hashmap, where we put a key,value pair and then lookup using key. However, there …

BiMap: A two-way Map in #android Read More »

AntiSpyware Fraud on #Android’s Google Play

Read Time 2 minutes States have been making money for decades on the name of  “Security”. After the revolution of mobile phones many companies are doing the same in the world of  mobile applications. After Realizing the fact that many people, who owns smart phones, are conscious about their privacy, and majority of those do not really know about …

AntiSpyware Fraud on #Android’s Google Play Read More »

Db4o Concurrent Access

Read Time < 1 minute Db4o has access limitations, which means you cannot use the ObjectContainer to query/store objects in different process than the one it was opened in. For example if you open db ObjectContainer db= Db4oEmbedded.openFile(Db4oEmbedded.newConfiguration(),DB_PATH); You cannot use this ObjectContainer, db for database operations in other processes. If you try to open db again in some other …

Db4o Concurrent Access Read More »

Using Database for Object (db4o) in android part-2

Read Time 2 minutes In previous post we discussed db4o benefits over relational databases and saw how we can setup and use db4o in android applications. Today we will go little deeper in understanding the advance functionality of  db4o and its querying mechanism. QBE is easy but We need more sophisticated  mechanisms of querying in actual android applications, and that’s Native …

Using Database for Object (db4o) in android part-2 Read More »

Using database for objects (db4o) in android part-1

Read Time 4 minutes Mapping object paradigm to relational paradigm is very hectic job for programmer and intensive for processor. As mobile development move to object oriented paradigm, we need object based database where we can directly store/retrieve/update and delete objects without first converting them to relational table entities. Fortunately we have db4o, which was released just after first …

Using database for objects (db4o) in android part-1 Read More »