Tag Archives: MotionEvent

Creating a custom Sliding GalleryView with Paging in android

By | June 28, 2012

This is a simple example showing A sliding Gallery in android. This example shows a sliding gallery with a paging Control and a changing page text which also indicate the page change. Create a new project named “SlidingGallery” and copy this code into “SlidingGalleryDemo.java“. My Activity name is “SlidingGalleryDemo.java” here. [java] package com.coderzheaven.pack; import android.app.Activity; import android.content.Context; import… Read More »

How to use Calendar in Android?

By | March 5, 2012

Hello all……. In today’s post I will show you how to use Calendar in android. Actually it is really easy to use calendar in android. For that android provides a calendar widget. We use calendar class to show the Calendar widget. Here is the java source code for this example. [java] package com.coderzheaven.pack; import java.util.Calendar; import android.app.Activity; import… Read More »

How to save data or score in Android Cocos2D?

By | January 21, 2012

Hello Friends Today I will show you how to save data in cocos2D android in a database and reload it when the game starts. This has been always a problem withe game developers for cocos2D android. I will show you a way to save almost any number of data in a database using SQlite in android. Check these… Read More »

Using Gestures in ANDROID,A Simple example.

By | March 29, 2011

This is a really simple example illustrating gestures in ANDROID. You Know that everything you do with your hand inside the phone is a gesture like SingleTap, doubleTap etc. Here is a quick illustration of this. For this the activity must implement OnGestureListener. The GestureDetector detects the gestures. Let’s look at the example. [java] package pack.GestureSampleThree; import android.app.Activity;… Read More »

How to drag and drop in ANDROID?

By | September 18, 2010

The following code helps you to do a drag and drop in ANDROID. [java] package com.pack; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.os.Bundle; import android.view.MotionEvent; import android.widget.AbsoluteLayout; import android.widget.Button; import android.widget.ImageView; public class Touch extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyView tx = new… Read More »