Showing posts from April, 2014

Android Shutdown Sequence

What happened when I long press power button ?What is shutdown sequence ?How is it different from desktop linux shutdown sequence?How to change shutdown menu ? Many questions pop-up in mind when we think about Android shutdown sequence. Before you read about shutdown sequence I suggest you to read about boot sequence article. Android is linux based open source operating system, x86 (x86 is a series of computer microprocessor instruction set architectures based on the Intel 8086 CPU.) is most likely system where linux kernel is deployed however all Android devices are running on ARM process (ARM (formerly Advanced RISC Machine, which was formerly Acorn RISC Machine)) except Intel’s Xolo device ( Xolo comes with Atom 1.6 GHz x86 processor. Android shutdown sequence is different from desktop linux like ubuntu, fedora, etc. In this article I am going to explain shutdown sequence for Android only. Please refer “Linux Boot and Shutdown Process” for details…

Voice Recognition

This post about how to search voice based search places instead typing the text.

Source Code

Call Voice recognition 

 Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);

intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Tell me what you want");

Retrun Result Method

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(requestCode == REQUEST_RECOGNIZE && resultCode == Activity.RESULT_OK) {
            ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            StringBuilder sb = new StringBuilder();
for(String piece : matches) {

Run Multiple AsyncTask at the same time

Android Run Multiple AsyncTask Same TimeProblem: I am trying to excute Multiple asynctask same time(Android Version 4.0.1) but onPreExcute method only called  after that nothing happen.
Solution. AsyncTask uses a thread pool pattern for running the stuff from doInBackground(). The issue is initially (in early Android OS versions) the pool size was just 1, meaning no parallel computations for a bunch of AsyncTasks. But later they fixed that and now the size is 5, so at most 5 AsyncTasks can run simultaneously. 
TestAsyncTask firstAsync = new TestAsyncTask();

TestAsyncTask firstAsync = new TestAsyncTask();


Remove and Undo Listview Item with slide

Screen Shot 

Source Code 
Activity Code :
package com.example.undo;
import java.util.ArrayList;
import; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView;
publicclass MyListActivity extends ListActivity {
@Override protectedvoid onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);               getListView().setDivider(null);        }
protected ArrayAdapter<String> createListAdapter() { retur