Sunday 27 May 2012

Crop an Image in ANDROID.

Cropping an image in <a href="http://www.coderzheaven.com/android/" 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="http://www.coderzheaven.com/?p=1397" target="_blank">image in ANDROID</a> we need a source bitmap which is our image itself, the other one is the target <a href="http://www.coderzheaven.com/?p=3911" target="_blank">bitmap</a> which we have to
set the size as we want and a matrix.

Read the complete post from here..

http://www.coderzheaven.com/2011/03/15/crop-an-image-in-android/

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="http://www.coderzheaven.com/2012/03/29/custom-indeterminate-progressbar-for-android/" target="_blank">Custom Indeterminate progressBar for android?</a>
2. <a href="http://www.coderzheaven.com/2012/05/12/build-custom-progressbar-android-part-2/" 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 "TextProgressBar.java".

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

[java]
package com.coderzheaven.pack;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ProgressBar;

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

public TextProgressBar(Context context) {
super(context);
text = "0/100";
textPaint = new Paint();
textPaint.setColor(Color.BLACK);
}

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

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

@Override
protected synchronized void onDraw(Canvas canvas) {
super.onDraw(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;
drawableStateChanged();
}

public void setTextColor(int color) {
textPaint.setColor(color);
drawableStateChanged();
}
}
[/java]

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="http://www.coderzheaven.com/?p=2689" 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....
http://www.coderzheaven.com/2012/05/12/build-custom-progressbar-android-part-2/

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.....
http://www.coderzheaven.com/2012/03/29/custom-indeterminate-progressbar-for-android/