Tag Archives: Canvas Graphics

How to draw Arcs in Android using canvas?

By | January 10, 2013

This is a simple example showing how to draw Arcs in android, You can use this to create piecharts or someother similar thing you want. Here we have 3 classes. 1. GraphicsActivity.java 2. MainActivity.java 3. PictureLayout.java GraphicsActivity.java [java] package com.coderzheaven.arcdrawing; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; class GraphicsActivity extends Activity { // set to true to… Read More »

How to crop an Image in Android?

By | December 15, 2012

This is a sample program that launches the camera and crop the captured image. Check this link to another crop image example. http://www.coderzheaven.com/2011/03/15/crop-an-image-in-android/ This is the layout xml. activity_main.xml [xml] <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="3dp" android:text="@string/intro" android:textStyle="bold" /> <Button android:id="@+id/capture_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/capture" /> <ImageView android:id="@+id/picture" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:contentDescription="@string/picture"… Read More »

How to create CustomProgressBar in android – Part 3?

By | May 23, 2012

Hello all… In my previous posts I have shown two methods to create custom progressbar in android. Check out these tutorials to find out how? 1. How to build a custom progressBar in android- Part 2? 2. Custom progressbar in android with text – part 3 Today in this post I will show you a third method. Here… Read More »

Custom progressbar in android with text – part 3

By | May 18, 2012

Hello all…… I have posted two posts on how to customize a progressbar in android. 1. Custom Indeterminate progressBar for android? 2. How to build a custom progressBar in android- Part 2? 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… Read More »

How to create Image Reflection in Android?

By | January 8, 2012

This simple Activity creates a reflection of the provided image. [java] package com.coderzheaven.imagereflection; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.Shader.TileMode; import android.os.Bundle; import android.view.Menu; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; public class ImageReflection extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);… Read More »

How to show a sliding window from below in Android?

By | December 22, 2011

Hello everyone, I have already showed you how to use a SlidingViewer to create a slidingWindow. Today I will show another way to create such a window with the help of animation. Please check one of my previous posts to do this in another way. How to show a sliding window from below in Android? Check this new… Read More »

Crop an Image in ANDROID.

By | March 15, 2011

Cropping an image in ANDROID programmatically has always been a problem for ANDROID developers. So Here I am putting a sample code to demonstrate this. For cropping an image in ANDROID we need a source bitmap which is our image itself, the other one is the target bitmap which we have to set the size as we want… Read More »

Using GridView in ANDROID….

By | March 9, 2011

GridViews are those in which you can arrange elements in a two dimensional grid. It is what you see in the gallery where images are arranged. Here images are arranged in a two dimensional grid. Copy the below code and save it as “MyGridView.java” [java] package com.pack; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.GridView; import… Read More »