I have a TextView with an OnTouchListener. What I want is the character index the user is pointing to when I get the MotionEvent. Is there any way to get to the underlying font metrics of the TextView?
...
Hello
Actually I'm trying to implement an ontouchlistener into my android (1.5) application.
therefore i implemented the "ontouchlistener" into the class, and then i put my code into the:
public boolean onTouchEvent (MotionEvent e){
//code
}
The problem is, that if I am dragging over an (e.g.) Spinner or EditTextView than this Me...
I am using the following code to do things with gridview(slightly modified from http://developer.android.com/resources/tutorials/views/hello-gridview.html). I want to replace the onClicklistener and the onClick() method with their "touch" equivalents i.e. touchlistener and onTouch() so that when i touch an element in the gridview the ima...
Hi,
I have a ScrollView that surrounds my entire layout so that the entire screen is scrollable. The first element I have in this ScrollView is a HorizontalScrollView block that has features that can be scrolled through horizontally. I've added an ontouchlistener to the horizontalscrollview to handle touch events and force the view to...
I have an OnTouch and a setOnTouchListener that updates varibles which contain screen coord info. The problem is it doesnt seem to ever update them. On line 78, RGB.setText(test); it never changes from 0.0. If i were to move that line and the line above it into the onTouch it updates. any idea what is wrong? Thank you.
package com.evank...
i have used some sample code and am trying to tweak it to let me allow the user to touch the screen and zoom in the code runs fine with no errors but when i touch the screen nothing happens
package com.thomas.zoom;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable...
Hello friends, I am writting a calendar app, in which I am drawing the RectF on the canvas & drawing text on it with canvas.drawText method, But when user clicks I want the calendar date on which user has clicked.
Can any one please tell me?
...
The Timer works fine. The problem is that the method _dw.newgame() just get executed(if two seconds are over) if i touch the display. Maybe it have sth to do with the "OnTouchListener" ?
public class DrawView extends View implements OnTouchListener{
Timer timer = new Timer();
public DrawView(Context context)
{
timer.schedule(new Task(t...
I'm trying to implement a double-tap zoom like function in my MapView. The event always fires the first time, but never subsequent times. Below is my code. I have a feeling it has something to do with the map controller getting lost after the first time the event is fired.
import android.os.Bundle;
import android.view.MotionEvent;
impor...
Hi,
I have a layout which might be a bit unusual. The structure is the following:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<org.CustomSurfaceView
android:id="@+id/page_flip"...
Hey
I have an AbsoluteLayout which has an OnTouchListener. Inside this layout there is a much smaller LinearLayout positioned dynamically. The OnTouchListener works as expected.
Now the problem comes when I add a LongClickListener to my LinearLayout. That disables my OnTouchListener if the touch hits the LinearLayout but it is still tr...
I have an application that shows a textview occupying most of the screen. When the user clicks on a portion of the textview I want to find the closest character to where they clicked so I can show them information about that part of the text in detail. I have the OnTouchListener and I can get the x,y of the click but does anyone have a...
I have a scroll view that contains a linear layout. In the linear layout are the child linear layouts.
I would like to give the user some peace of mind that he is touching the right child.
I can put in an on click that highlights it to tell what he just clicked,
I can put an ontouch to highlight what he is about to click,,
But how do...
I have a onTouchlistener for a game that the object is to follow the dot around the screen with your finger for as long as you can. Therefore, if your finger goes out of bounds or if event.getAction() == MotionEvent.ACTION_UP, you lose. The problem is that MotionEvent.ACTION_UP is being fired 30 seconds after the MotionEvent.ACTION_DOWN ...
my problem is a simple one. i want to play a looping sound only when a button is pressed. the following are the switch statement and if else approaches i've tried. at best, i can play the sound but it won't pause when the button is no longer pressed.
public boolean onTouch(View v, MotionEvent event) {
MediaPlayer mp = MediaPlayer...
I've set up an onTouch class to determine when one of my 40 buttons is pressed.
The problem I am facing is determining which button was pressed.
If I use:
int ID = iv.getId();
When I click on button "widgetA1"
I receive the following ID:
2131099684
I would like it to return the string ID "widgetA1"
from:game.xml
<ImageView andro...