Can I extend the Overlay class? - java

I have created a class that extends the Overlay class in Osmdroid (CustomOverlay.java). However, nothing appear on the map after I call the method createMark() on the main activity which make use of CustomOverlay.java. I do not want to use ItemizedOverlay class.
Any idea?
CustomOverlay.java (class that extends Overlay)
public CustomOverlay(Context context) {
super(context);
}
#Override
protected void draw(Canvas canvas, MapView mapView, boolean shadow) {
Point screenPoint = new Point();
mapView.getProjection().toPixels(geoPoint, screenPoint);
super.drawAt(canvas, mapView.getResources().getDrawable(R.drawable.marker), screenPoint.x, screenPoint.y, shadow);
}
}
This is the method I call in the main activity:
private void createMarker() {
List<Overlay> mapOverlays = mMapView.getOverlays();
Overlay c = new CustomOverlay(this);
mapOverlays.add(c);
mMapView.invalidate();
}
Answer:
#Override
protected void draw(Canvas canvas, MapView mapView, boolean shadow) {
Point screenPoint = new Point();
mapView.getProjection().toPixels(geoPoint, screenPoint);
Bitmap marker= BitmapFactory.decodeResource(mapView.getResources(), R.drawable.marker);
canvas.drawBitmap(marker, screenPoint.x, screenPoint.y, null);
}

Here's the skeleton of a customized overlay:
public class MyItemizedOverlay extends ItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
public MyItemizedOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));
}
protected OverlayItem createItem(int i) {
return mOverlays.get(i);
}
#Override
public int size() {
return mOverlays.size();
}
public void removeAllOverlay() {
mOverlays.clear();
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
}
See the differences? Where is your populate() call?
Hope this helps.

Related

Issue in rendering Camera Preview using OpenGL ES 2.0

This is the first time I am trying to render the Camera Preview using OpenGL ES 2.0. I am into some issues with the code. Here goes the code below --
MainActivity.java
public class MainActivity extends AppCompatActivity implements SurfaceTexture.OnFrameAvailableListener {
private Camera mCamera;
private GLSurfaceView glSurfaceView;
Bitmap bitmap;
FrameLayout frameLayout;
DrawOnTop drawOnTop;
FrameLayout.LayoutParams layoutParams;
private SurfaceTexture surface;
MyGLRenderer renderer;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
frameLayout = (FrameLayout)findViewById(R.id.camera_preview);
drawOnTop = null;
}
public void onCamViewButtonClicked (View view)
{
glSurfaceView = new MyGLSurfaceView(this);
renderer = MyGLSurfaceView.getRenderer();
frameLayout.addView(glSurfaceView);
}
public void startCamera(int texture)
{
surface = new SurfaceTexture(texture);
surface.setOnFrameAvailableListener(this);
renderer.setSurface(surface);
mCamera = Camera.open();
try
{
mCamera.setPreviewTexture(surface);
mCamera.startPreview();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
public void onFrameAvailable(SurfaceTexture surfaceTexture)
{
glSurfaceView.requestRender();
}
public void onOverlayImageButtonClicked(View view)
{
if(glSurfaceView == null)
{
Toast.makeText(getApplicationContext(),"Preview is not available now!",Toast.LENGTH_LONG).show();
return;
}
else {
if(drawOnTop != null)
{
frameLayout.removeView(drawOnTop);
drawOnTop = null;
}
else
{
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.internetothings);
drawOnTop = new DrawOnTop(this, bitmap);
layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
frameLayout.addView(drawOnTop, layoutParams);
Toast.makeText(getApplicationContext(),"Click again to remove!",Toast.LENGTH_LONG).show();
}
}
}
public void onPause()
{
super.onPause();
mCamera.stopPreview();
mCamera.release();
}
}
MyGLSurfaceView.java
public class MyGLSurfaceView extends GLSurfaceView{
static MyGLRenderer myGLRenderer;
public MyGLSurfaceView(Context c)
{
super(c);
setEGLContextClientVersion(2);
myGLRenderer = new MyGLRenderer((MainActivity)c);
setRenderer(myGLRenderer);
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
}
public static MyGLRenderer getRenderer()
{
return myGLRenderer;
}
}
MyGLRenderer.java
public class MyGLRenderer implements GLSurfaceView.Renderer{
int texture;
private SurfaceTexture surfaceTexture;
MainActivity mainActivity;
public MyGLRenderer(MainActivity main)
{
mainActivity = main;
}
public void onSurfaceCreated(GL10 unused, javax.microedition.khronos.egl.EGLConfig config)
{
texture = createTexture();
GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
mainActivity.startCamera(texture);
}
public void onDrawFrame(GL10 unused)
{
float[] mtx = new float[16];
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
surfaceTexture.updateTexImage();
surfaceTexture.getTransformMatrix(mtx);
}
public void onSurfaceChanged(GL10 unused, int width, int height)
{
GLES20.glViewport(0, 0, width, height);
}
static private int createTexture()
{
int[] texture = new int[1];
GLES20.glGenTextures(1, texture, 0);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, texture[0]);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR);
GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
return texture[0];
}
public void setSurface(SurfaceTexture _surface)
{
surfaceTexture = _surface;
}
}
Issue 1: After all this, I am getting a Grey texture instead of a Camera Preview. As a reference I have checked this post. Please help me to identify what went wrong over here.
Issue 2: While investigating Issue 1, I feel (not sure though) that in MyGLSurfaceView.java, declaring myGLRenderer as static could be a problem. Also I have declared the method getRenderer() as static as well which might cause the issue. So I removed the static keyword as below --
public class MyGLSurfaceView extends GLSurfaceView {
MyGLRenderer myGLRenderer;
public MyGLSurfaceView(Context c)
{
super(c);
setEGLContextClientVersion(2);
myGLRenderer = new MyGLRenderer((MainActivity)c);
setRenderer(myGLRenderer);
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
}
public MyGLRenderer getRenderer()
{
return myGLRenderer;
}
}
But then I run into a very weird issue in this line --
glSurfaceView = new MyGLSurfaceView(this);
renderer = glSurfaceView.getRenderer();
It says "Cannot resolve method getRenderer()".
Can anybody please help me get over these two issues?
Thanks in advance!
You can try various options:
I had the issue null point exception: MainActivity.startCamera.
First, I would say check your device settings: Settings --> Apps --> (Your App) --> permissions and change it to camera.
Second, you can try changing your startCamera() because we need to release the camera after we performed the event. Modified as follows:
public void startCamera(int texture) {
releaseCameraAndPreview();
surface = new SurfaceTexture(texture);
surface.setOnFrameAvailableListener(this);
renderer.setSurface(surface);
mCamera = Camera.open();
Camera.Parameters parameters = mCamera.getParameters();
mCamera.setParameters(parameters);
try
{
mCamera.setPreviewTexture(surface);
mCamera.startPreview();
}
catch (IOException ioe)
{
Log.w("MainActivity","CAM LAUNCH FAILED");
}
}
just add releaseCameraAndPreview() at the bottom of MainActivity()
private void releaseCameraAndPreview() {
if (mCamera != null) {
mCamera.release();
mCamera = null;
}
}
Try that and let us know. There can be other options too, eg. changing in the manifest file : Add the following
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
Hope this helps

Calling handler.removeCallbacks from onDeleted method in a widget throws a nullpointerexception

I need to stop the handler when the widget is removed by the user but calling handler.removeCallbacks throws a nullpointerexception from the onDeleted method. I tried other workarounds like creating a method,in a class which implements runnable, to kill the runnable but this throw a nullpointerexception also.
Maybe handler gets null after the call of the onDeleted method so I tried to put it in the onDisabled method but nothing stop.
What am I doing wrong?
Here the code :
public class RAMWidget extends AppWidgetProvider {
private PieGraph pg;
private Context context;
private RemoteViews remoteViews;
private AppWidgetManager appWidgetManager;
private ComponentName widget;
private Handler handler;
private CustomRunnable runnable;
#Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
{
this.context=context;
this.appWidgetManager=appWidgetManager;
remoteViews=new RemoteViews(context.getPackageName(),R.layout.widget_ram);
widget=new ComponentName(context,RAMWidget.class);
new DrawTask().execute();
handler=new Handler();
runnable=new CustomRunnable();
handler.postDelayed(runnable,3000);
}
private class CustomRunnable implements Runnable
{
private boolean stop;
public CustomRunnable()
{
stop=false;
}
#Override
public void run()
{
new DrawTask().execute();
Log.i("STOP",stop+"");
if(!stop)
handler.postDelayed(this,3000);
else
return;
Log.i("STOP",stop+"");
}
void killThread()
{
stop=true;
}
}
private class DrawTask extends AsyncTask<Void,Void, Void>
{
private PieSlice slice,_slice;
private long total=0,free=0,rate=0;
#Override
protected Void doInBackground(Void... unused)
{
RandomAccessFile reader=null;
try
{
reader=new RandomAccessFile("/proc/meminfo","r");
long[] mems=new long[4];
for(int i=0;i<4;i++)
{
String load = reader.readLine();
String[] toks = load.split(":");
mems[i] = Long.parseLong(toks[1].replace("kB","").trim());
}
total=mems[0]/1024;
free=(mems[1]+mems[2]+mems[3])/1024;
rate=(int)((float)(total-free)/total*100);
}
catch (Exception e)
{
e.printStackTrace();
}
if(reader!=null)
try
{
reader.close();
}
catch (IOException e)
{
e.printStackTrace();
}
slice=new PieSlice();
slice.setTitle("Available RAM");
slice.setColor(Color.parseColor("#99CC00"));
slice.setValue(total-free);
_slice=new PieSlice();
_slice.setTitle("Used RAM");
_slice.setColor(Color.parseColor("#FFBB33"));
_slice.setValue(free);
publishProgress();
return null;
}
#Override
protected void onProgressUpdate(Void... values)
{
pg=new PieGraph(context);
pg.measure(200,200);
pg.layout(0,0,200,200);
pg.setDrawingCacheEnabled(true);
pg.addSlice(slice);
pg.addSlice(_slice);
pg.setInnerCircleRatio(150);
for (PieSlice s : pg.getSlices())
s.setGoalValue(s.getValue());
pg.setDuration(1000);
pg.setInterpolator(new AccelerateDecelerateInterpolator());
pg.animateToGoalValues();
pg.setPadding(3);
remoteViews.setTextViewText(R.id.widget_ram_text, "Total RAM " + total + " MB");
remoteViews.setTextViewText(R.id.widget_ram_text1,"Avaiable RAM "+(total-free)+" MB");
remoteViews.setTextViewText(R.id.widget_ram_text2,"Used RAM "+free+" MB");
Bitmap bitmap=pg.getDrawingCache();
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.BLACK);
paint.setTextSize(18);
paint.setShadowLayer(1f,0f,1f,Color.WHITE);
Rect bounds=new Rect();
paint.getTextBounds(rate+" %",0,new String(rate+" %").length(),bounds);
int x=(bitmap.getWidth()-bounds.width())/2;
int y=(bitmap.getHeight()+bounds.height())/2;
canvas.drawText(rate+" %",x,y,paint);
remoteViews.setImageViewBitmap(R.id.graph_widget,bitmap);
appWidgetManager.updateAppWidget(widget,remoteViews);
}
}
#Override
public void onDeleted(Context context, int[] appWidgetIds) {
runnable.killThread();
handler.removeCallbacks(runnable); //both of them don't work
super.onDeleted(context, appWidgetIds);
}
#Override
public void onDisabled(Context context) {
runnable.killThread();
handler.removeCallbacks(runnable);
super.onDisabled(context);
}
}
The problem is that you can't depend on the same instance of your widget being called by Android each time, and so keeping non-static fields in your widget provider is a problem.
An easy solution would be to use static fields for handler and runnable. It looks like some of the other fields could go away too, for example PieGraph is constructed each time onProgressUpdate is called, so it could be a local. Basically you should avoid all non-static fields in a widget.

Android: extend Linearlayout, but need same for RelativeLayout. Duplicate code unavoidable?

I have this code:
public class CopyOfLinearLayoutEntry extends LinearLayout implements Checkable {
private CheckedTextView _checkbox;
private Context c;
public CopyOfLinearLayoutEntry(Context context) {
super(context);
this.c = context;
setWillNotDraw(false);
}
public CopyOfLinearLayoutEntry(Context context, AttributeSet attrs) {
super(context, attrs);
this.c = context;
setWillNotDraw(false);
}
#Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(200, 255, 230, 230);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(12);
Rect r = canvas.getClipBounds();
Rect outline = new Rect(1, 1, r.right - 1, r.bottom - 1);
canvas.drawLine(r.left, r.top, r.right, r.top, strokePaint);
}
#Override
protected void onFinishInflate() {
super.onFinishInflate();
// find checked text view
int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
View v = getChildAt(i);
if (v instanceof CheckedTextView) {
_checkbox = (CheckedTextView) v;
}
}
}
#Override
public boolean isChecked() {
return _checkbox != null ? _checkbox.isChecked() : false;
}
#Override
public void setChecked(boolean checked) {
if (_checkbox != null) {
_checkbox.setChecked(checked);
}
}
#Override
public void toggle() {
if (_checkbox != null) {
_checkbox.toggle();
}
}
}
Now I also need a version for RelativeLayout, so I would duplicate the class file and replace "extends LinearLayout" with "extends RelativeLayout". I think that would be bad, because I do not want any duplicate code.
How would I go about achieving my goal, seeing that Java does not allow multiple inheritance?
I read something about the composition design pattern, but I am not sure how to implement that.
Maybe someone could give me a starting point as to how to most elegantly solve this problem?
You don't need to extend both to avoid duplicate code. You can do something like this:
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckedTextView;
public class GenericLayout extends ViewGroup{
private CheckedTextView _checkbox;
public GenericLayout(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
#Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(200, 255, 230, 230);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(12);
Rect r = canvas.getClipBounds();
Rect outline = new Rect(1, 1, r.right - 1, r.bottom - 1);
canvas.drawLine(r.left, r.top, r.right, r.top, strokePaint);
}
#Override
protected void onFinishInflate() {
super.onFinishInflate();
// find checked text view
int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
View v = getChildAt(i);
if (v instanceof CheckedTextView) {
_checkbox = (CheckedTextView) v;
}
}
}
public boolean isChecked() {
return _checkbox != null ? _checkbox.isChecked() : false;
}
public void setChecked(boolean checked) {
if (_checkbox != null) {
_checkbox.setChecked(checked);
}
}
public void toggle() {
if (_checkbox != null) {
_checkbox.toggle();
}
}
#Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
}
}
public class Linear extends LinearLayout {
GenericLayout generic;
public Linear(Context context) {
super(context);
// TODO Auto-generated constructor stub
generic = new GenericLayout(context);
}
#Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
generic.onDraw(canvas);
}
...
}
public class Relative extends RelativeLayout{
GenericLayout generic;
public Relative(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
#Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
generic.onDraw(canvas);
}
...
}
Of what I have learned and been using, there are two ways:
You can do what you are trying to avoid (duplicate the class file and replace "extends LinearLayout" with "extends RelativeLayout")
You can create 2 interfaces and 1 class: One interface that extends LinearLayout, another one for extending RelativeLayout and the class implementing the methods and variables of the extending interfaces.
I hope that helps a little
You have to rethink your approach.
Seems like you are are using layout to control VIEW logic. Unfortunately your question does not have too much information about what you are trying to achieve.
You have few possibilities:
implement LAYOUT proxy / delegate with the custom logic (bad approach IMO)
make a dedicated HANDLER class to control your VIEW objects... these will be independent on the LAYOUT
make your VIEW object and use VIEW object instead of LAYOUT (probably the way to go)

Java Android Bound mismatch

I am still relatively new to Java, and am trying to work with the code at the address. http://proyectouvipool.googlecode.com/svn-history/r87/trunk/Android/PFC/src/pablo/developer/BalloonItemizedOverlay.java
Unfortunately, I get the following error message
Bound mismatch: The type Item is not a valid substitute for the bounded parameter of the type BalloonOverlayView
at code
protected BalloonOverlayView<Item> createBalloonOverlayView() {
return new BalloonOverlayView<Item>(getMapView().getContext(), getBalloonBottomOffset());
}
Would appreciate some help on what to do to fix this?
public class CustomBalloonItemizedOverlay extends
BalloonItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> m_overlays = new ArrayList<OverlayItem>();
private Context c;
public MyFavoritePlacesItemizedOverlay(Drawable defaultMarker,
MapView mapView) {
super(boundCenter(defaultMarker), mapView);
c = mapView.getContext();
}
public void addOverlay(OverlayItem overlay) {
m_overlays.add(overlay);
populate();
}
#Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
if (!shadow) {
super.draw(canvas, mapView, false);
}
}
public void removeOverlay(OverlayItem overlay) {
m_overlays.remove(overlay);
populate();
}
#Override
protected OverlayItem createItem(int i) {
return m_overlays.get(i);
}
#Override
public int size() {
return m_overlays.size();
}
#Override
protected boolean onBalloonTap(int index, OverlayItem item) {
// Your code...
return true;
}
}
Below is how to use that...
initGeoPoint = new GeoPoint((int) (latitude * 1E6),
(int) (longitude * 1E6));
mapOverlays = myMapView.getOverlays();
drawableImage = this.getResources().getDrawable(R.drawable.any_icon);
CustomBalloonItemizedOverlay customItemizedOverlayObject = new public class CustomBalloonItemizedOverlay(
drawableImage, myMapView);
OverlayItem overlayItem = new OverlayItem(initGeoPoint, name,
address);
customItemizedOverlayObject.addOverlay(overlayItem);
mapOverlays.add(customItemizedOverlayObject);
}

how to make android flipper animation using onFling()?

I'm having trouble in adding a little animation in onfling method. Everything is working just fine. Flipping pages left to right and right to left is done but there's no animation. I tried various things but couldn't get the animation working. Please guide me how can I add flipper animation or swipe animation. Here is the code:
public class MainActivity extends CustomTitlebarActivityBase {
// some random variables..
// detect swipe left/right
private GestureDetector gestureDetector;
private MyGestureListener gestureListener;
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "Creating MainActivity");
super.onCreate(savedInstanceState, true);
setContentView(R.layout.main_view);
// create related objects
gestureListener = new MyGestureListener(MainActivity.this);
gestureDetector = new GestureDetector( gestureListener );
documentViewManager = new DocumentViewManager(this);
documentViewManager.buildView();
myContentManager = new myContentManager(documentViewManager);
// force the screen to be populated
myContentManager.updateText(true);
}
// there are some other methods
/** user swiped left */
public void next() {
if (getDocumentViewManager().getDocumentView().isPageNextOkay()) {
CurrentPageManager.getInstance().getCurrentPage().next();
}
}
/** user swiped left */
public void previous() {
if (getDocumentViewManager().getDocumentView().isPagePreviousOkay()) {
CurrentPageManager.getInstance().getCurrentPage().previous();
}
}
}
// here is the listener class
public class MyGestureListener extends SimpleOnGestureListener {
// measurements in dips for density independence
private static final int DISTANCE_DIP = 40;
private int scaledDistance;
private int minScaledVelocity;
private MainActivity mainActivity;
private boolean sensePageDownTap;
private static final String TAG = "MyGestureListener";
public MyGestureListener(MainActivity mainActivity) {
super();
this.mainActivity = mainActivity;
scaledDistance = CommonUtils.convertDipsToPx(DISTANCE_DIP);
minScaledVelocity = ViewConfiguration.get(mainActivity).getScaledMinimumFlingVelocity();
// make it easier to swipe
minScaledVelocity = (int)(minScaledVelocity*0.66);
}
#Override
public void onLongPress(MotionEvent e) {
// do something
}
// here is the onFling
#Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
// get distance between points of the fling
double vertical = Math.abs( e1.getY() - e2.getY() );
double horizontal = Math.abs( e1.getX() - e2.getX() );
Log.d(TAG, "onFling vertical:"+vertical+" horizontal:"+horizontal+" VelocityX"+velocityX);
if ( vertical > scaledDistance ) {
return false;
}
// test horizontal distance and velocity
else if ( horizontal > scaledDistance && Math.abs(velocityX) > minScaledVelocity ) {
if (e1.getX() > e2.getX()) {
mainActivity.next();
}
// left to right swipe
else {
mainActivity.previous();
}
return true;
}
return false;
}
}
Try to implement OnGestureListener. Sample code is beloe
public class MyActivity extends Activity implements GestureDetector.OnGestureListener {
private GestureDetector gestureScanner;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.yourlayout);
this.gestureScanner = new GestureDetector(this);
}
#Override
public boolean dispatchTouchEvent(MotionEvent paramMotionEvent) {
super.dispatchTouchEvent(paramMotionEvent);
return this.gestureScanner.onTouchEvent(paramMotionEvent);
}
public boolean onDown(MotionEvent paramMotionEvent) {
return false;
}
public boolean onFling(MotionEvent paramMotionEvent1, MotionEvent paramMotionEvent2, float paramFloat1,
float paramFloat2) {
// your fling code goes here
return true;
}
public void onLongPress(MotionEvent paramMotionEvent) {
}
public boolean onScroll(MotionEvent paramMotionEvent1, MotionEvent paramMotionEvent2, float paramFloat1,
float paramFloat2) {
return false;
}
public void onShowPress(MotionEvent paramMotionEvent) {
}
public boolean onSingleTapUp(MotionEvent paramMotionEvent) {
return false;
}
}

Categories