Sunday, 27 May 2012

Crop an Image in ANDROID.

Cropping an image in <a href="" target="_blank">ANDROID</a> programmatically has always been a problem for ANDROID developers.
So Here I am putting a sample code to demonstrate this.
For cropping an <a href="" target="_blank">image in ANDROID</a> we need a source bitmap which is our image itself, the other one is the target <a href="" target="_blank">bitmap</a> which we have to
set the size as we want and a matrix.

Read the complete post from here..

Thursday, 24 May 2012

Custom progressbar in android with text - part 3

Hello all......

I have posted two posts on how to customize a progressbar in android.

1. <a href="" target="_blank">Custom Indeterminate progressBar for android?</a>
2. <a href="" target="_blank">How to build a custom progressBar in android- Part 2?</a>

Here is another one with update text on top of the progressbar.

Here is how we start.

After creating a fresh project create a new java file and name it "".

Now copy this code to the above file.
This file extends the progressbar to add additional functionality.

package com.coderzheaven.pack;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ProgressBar;

public class TextProgressBar extends ProgressBar {
private String text;
private Paint textPaint;

public TextProgressBar(Context context) {
text = "0/100";
textPaint = new Paint();

public TextProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
text = "0/100";
textPaint = new Paint();

public TextProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
text = "0/100";
textPaint = new Paint();

protected synchronized void onDraw(Canvas canvas) {
Rect bounds = new Rect();
textPaint.getTextBounds(text, 0, text.length(), bounds);
int x = getWidth() / 2 - bounds.centerX();
int y = getHeight() / 2 - bounds.centerY();
canvas.drawText(text, x, y, textPaint);

public synchronized void setText(String text) {
this.text = text;

public void setTextColor(int color) {

OK the progressbar class is now complete.

Monday, 14 May 2012

Samsung Galaxy S III India launch in June first week

Samsung is expected to launch its all new Galaxy S III smartphone in India in the first week of June. According to NDTV Gadgets, India is in the first list of countries to get smartphone, which will see the launch starting May 29.

The smartphone will be priced at INR 38,000, while the street price is likely to be in the vicinity of INR 34,000.

Saturday, 12 May 2012

How to build a custom progressBar in android- Part 2?

Hello all.......

Today I am going to show you how to create a custom progressbar in android.
Previously in another posts I have already shown <a href="" target="_blank">how to build a custom indeterminate progressbar in android.</a>
And in this post I will show you how to customize the horizontal progressbar.

See the complete post here....

Custom Indeterminate progressBar for android?

Hello everyone...

Today we will see how to customize an indeterminate progressBar in android.
<strong>For that we have to create an xml with a progress animation.For this I used these three images</strong>

Continue from here.....