Skip to main content


Showing posts from June, 2013

Regular bitmap and a Nine-patch image

A Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

Leaked images of iPhone 5S, Galaxy Note III

As the second half of the year approaches, the technology industry is abuzz with rumours of the two hottest upcoming smartphones - Apple iPhone 5S and Samsung Galaxy Note III. The Cupertino-based tech giant is widely expected to launch its next flagship smartphonet in the third quarter, while its fierce South Korean rival will launch the top-end phablet in August. However, both the devices have once again emerged in leaked pictures before their official launch.

read more from :

Custom Toggle Button in ANDROID

Toggle Button is a special button that has two states  for eg :"on" and "off".It can be an alternative to Radio Buttons.
Method to create a Custom Toggle Button is given below :

in custom_btn.xml in style.xml : in custom_toggle_bg.xml : in custom_toggle_btn.xml :

Toggle button in ANDROID - An alternative to radio button

Toggle Button is a special button that has two states  for eg :"on" and "off".It can be an alternative to Radio Buttons.
Below are some methods mentioned in this example :
setOnClickListener – Used to register a callback whenever view is clicked
setChecked() – used to mark toggle button as checked/unchecked
setTextOn() – used to display text on toggle button whenever it is CHECKED
setTextOff() – used to display text on toggle button whenever it is UnCHECKED.

public class MainActivity extends Activity { ToggleButton toggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toggle = (ToggleButton) findViewById(; // you can set text accordingly when checked or not toggle.setTextOn("Toggle is Checked"); toggle.setTextOff("Toggle is not Checked"); // you can set if toggle to be checked or not toggle.setChecked(true); toggle.setOnC…

Delete A row in ListView with Animation

Listview is simply a group of view that displays a list of scrolling items. "Adapters" are used to insert list items to the list.By default we are able to provide only text as list items.In order to delete a row from listview, copy or download this javacode and try yourself.
Also see here :
Android – Bullets in ListViewListView in Alphabetic Order in ANDROIDSingle Selection ListView in androidSimple ListView in Android java file : public class SimpleListViewActivity extends Activity { private ListView mainListView; private ArrayAdapter<String> listAdapter; ArrayList<String> all_rowtext = new ArrayList<String>() ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Find the ListView resource. mainListView = (ListView) findViewById(; all_rowtext.add("Angel"); all_rowtext.add("Mark"); all_rowtext.add("Coding"); all…

Spannable String in Android - URL Span ,Clickable Span, Rich-Style Formatting of Textview .....

See more Android Tutorials here.......

Faster Loading images in GridViews or ListViews

Spannable brings lots of possibility to TextView, includes displaying various appearance of a Text and onClick callbak.
The SpannableString class allows you to easily format certain pieces which are called spans of a string, by applying CharacterStyle ie,color, font, ormake it a link .
Here is an example where, explained how to use spannable string to give font size, color, linking a text via clickable span and through URL Span and to strike through the text.
Lets go through the example : import android.os.Bundle; import android.text.SpannableString; import android.text.method.LinkMovementMethod; import; import; import; import; import; import android.view.View; import android.widget.TextView; import android.widget.Toast; import android.…

Samsung puts Galaxy Camera on a diet to make S4 Zoom smartphone

The Galaxy S4 Zoom can be described as an S4 Mini with a 10x optical zoom attached to the back of it, according to Ben Wood, director of research at analyst firm CCS Insight. The camera-phone's arrival scoops a reported Windows Phone version of Nokia's 41-megapixel 808 PureView, and should leave camera makers like Nikon and Canon a little concerned, he said. In less than two weeks, Samsung has launched two tablets and four smartphones, including the Galaxy S4 Zoom. The company is expected to launch more products at an event in London on June 20. read more from here :

Interview Question 21 - 30

See more basics on Android along with interview questionsExplain about the Android Exceptions ? The following are the exceptions that are supported by Android InflateException :         When an error conditions are occurred, this exception is thrown Surface.OutOfResourceException:         When a surface is not created or resized, this exception is thrown SurfaceHolder.BadSurfaceTypeException:          This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS WindowManager.BadTokenException:          This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.
What is Drawable? A compiled visual resource that can be used as a background, title, or other part of the screen. It is compiled into an subclass.
What is an Intent Receiver? An application class that listens for messages broadcast by calling Context.broadcastIntent .
What is a Resource ? A user-suppl…

Interview Questions 11 -- 20

See more basics on Android along with interview questionsTalk on Android OS ?
                 Android is a Linux-based operating system designed primarily for touchscreen mobile
devices such as smartphones and tablet computers. Initially developed by Android, Inc., which Google backed financially and later bought in 2005.Android is the world's most popular mobile platform.
Android is a Linux-based mobile phone operating system developed by Google. Android is
unique because Google is actively developing the platform but giving it away for free to
hardware manufacturers and phone carriers who want to use Android on their devices.

What is Android SDK ?
                A software development kit that enables developers to create applications for the Android
platform. The Android SDK includes sample projects with source code, development tools,
an emulator, and required libraries to build Android applications. Applications are written
using the Java programming language and run on Dalv…

What is .dex extension in ANDROID ?

Compiled Android application code file. Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language.

Interview Questions 1 -- 10

See more basics on Android along with interview questionsWhat is definition of Android ?
               Android is a software stack for mobile devices that middleware, operating systems,
   and application-specific key. The application must be implemented in its own process
   and the Dalvik virtual machine interface. DVM is used effectively run multiple virtual
   machines. Java byte code is executed which is converted file format called Dex.

How the data will be stored in Android or types of data stored in Android ?
Internal Storage  Connecting to a network   General preferences   SQLite database  External StorageWhat are the components of Android Application ?                Android is written in java programming language.Android application are composed of       some of the main components such as:     Activities    Services    Content providers    Broadcast receivers  Explain each components of Android Application ?   see this post…

Thread Example in ANDROID -- Timer Thread Example

See more post on threads :
Non Runnable States in Multithreading

What is thread in java ?

This example shows how a thread get activated on every interval of time. Here an array of string is given which is used to display a text change for every activated thread calls.

public class Threadexample extends Activity { protected int splashTime = 3000; TextView tv1; String[] name = {"Angel","Mark","Coding","Playground","For","All","Coderz"}; int timer =0; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_threadexample); tv1 = (TextView) findViewById(; Thread th=new Thread(){ @Override public void run(){ try { for (timer = 0; timer …

Non Runnable States in Multithreading - Different states while thread is in runnable states

See more basics of thread in java here :
What is thread in java ?
The different states while thread is in runnable states are given below :
Sleeping States :
may be alive, but not running may return to runnable state stop running for an amount of time Waiting for Notifications :
wait for notification from other  send to runnable after notified threadBlocked on I/O :
after availability of resource sends to runnableBlocked for Joint Completion :
waiting for completion of another threadBlocked for Lock Acquistion : Come to this state because of  waiting to acquire the lock of an object.

What is a thread in java ?

see more post :
Non Runnable States in Multithreading - Different states while thread is in runnable states

A thread is a lightweight process.While dealing with one thread called single thread and with more thread called multi thread.

Main Thread :
When a standalone application is running it is in main thread. What created inside is called  child thread.

Life Cycle Of Thread or States Of Thread :

           New State:
When it is created and is when the thread is not alive ie, before start( ).

           Runnable (ready to run) State:
After invoking start( ) it goes to runnable state.
                        Can return to this state after running, waiting, sleeping or back from blocked state.

           Running State:
This state is at executing state.

           Dead State:
This state begins when run( ) methods completes, from here it will never run again.

           Blocked State:
A thread can enter in this state because of waiting the resources that are hold by another

Android is a multitasking operating system -- Explanation

Android is a true multitasking operating system . Android decides that it has sufficient resources it will maintain the app in a background state that can be brought quickly back to the foreground (for example, by clicking on the app's icon, or clicking the Back button---the curved back arrow---on the device). Many phones facilitate multitasking by making it easy to find the applications that have most recently been executing in the foreground.

What is DDMS in ANDROID ?

Android provides a debugging tool called the Dalvik Debug Monitor Server (DDMS).
        DDMS provides port-forwarding services.Screen capture on the device.Thread and heap information on the device.Logcat.Process.Radio state information.        Incoming call and SMS spoofing, location data spoofing, and more.

To open DDMS goto Windows--> Open prespective--> other, DDMS

Select DDMS and you will get a window like this

Here from this window you can take screenshots, send sms , make a call.......