Saturday, 29 December 2012

How to load a spinner with values from SQlite Database in android?

Here is a simple example showing how to load a database values in a spinner in android.

OK we will start.
This is the layout for the spinner row.


Read the complete post here...

How to crop an Image in Android?

This is a sample program that launches the camera and crop the captured image.

Check this link to another crop image example.

This is the layout xml.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
    android:orientation="vertical" >

        android:textStyle="bold" />

        android:text="@string/capture" />

        android:contentDescription="@string/picture" />


Now this is the Main Java File that implements the crop functionality.

Read More from here...

Monday, 24 December 2012

Select an Image from gallery in ANDROID and show it in an ImageView.

Hi all
In this tutorial I will show you how to get an image from your phone gallery and show it in an imageview.
Here we use intents to open up the image gallery and get the image URI.
Here I am setting the image type as “image” to get only the images.
And on onActivityResult if the result is OK, then get the data using getData() function and converting the imageURI to the stringPath.

Read more from here

Saturday, 15 December 2012

Customizing a spinner in android.

Hello everyone.........

 You all knew that a spinner or combobox is an inbuilt widget in android. And Like any other widgets spinners are also customizable. Here is a simple example to customize a spinner. First we will look at the java code. The getView method is called for each row in the spinner. So with the help of an Layout Inflater you can inflate any layout for each row. At extreme you can have each layout for each row. Check these older posts about spinner.

 1. How to get a selected Item from a spinner in ANDROID?
 2. How to set an item selected in Spinner in ANDROID?
 3. How to create a custom ListView in android?

Check out these of ListViews

 1. Simplest Lazy Loading ListView Example in Android with data populated from a MySQL database using php.
 2. How to add checkboxes and radio buttons to ListView in android? OR How to set single choice items in a ListView in android?

 Read complete code from here