dispatchTouchEvent

by Business Talk » Sat, 09 Jan 2010 02:15:29 GMT


Sponsored Links
 How can I programmatically press/release a button? I was playing with
the button.dispatchTouchEvent(motionEvent); but failed to
programmatically generate  the MotionEvent to be passed to the
dispatchTouchEvent



dispatchTouchEvent

by Business Talk » Sat, 09 Jan 2010 02:37:37 GMT


 I found the way to generate the MotionEvent, and it's
MotionEvent.obtain



> dispatchTouchEvent


Sponsored Links


dispatchTouchEvent

by jbo » Wed, 27 Jan 2010 04:28:07 GMT


 i , i have a qustion about onTouch event, I have a layout that
consist of 2 elements, a WebView and on top of it a TextView and then
a custom view, that expand all over the screen and is transparent.
With these i want to carch touch events and delegate to the correct
widget either TextView or WebView depending on the touch event
position (MoseEvent).

[code]
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type here:"/>

<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/label"/>

</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<com.frame.TransparentPanel android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>

</LinearLayout>

</FrameLayout>
[/code]


[code]
public class TransparentPanel extends LinearLayout
{
private Paint innerPaint, borderPaint ;
private List<PointF> pointsToDraw = new ArrayList<PointF>();
private WebView webview;
private Paint touchPaint;

public TransparentPanel(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}

public TransparentPanel(Context context) {
super(context);
init();
}

private void init() {
touchPaint = new Paint();
touchPaint.setARGB(255, 0, 0, 255);
touchPaint .setAntiAlias(true);
touchPaint .setStyle(Style.STROKE);
touchPaint .setStrokeWidth(2);

innerPaint = new Paint();
innerPaint.setARGB(0, 100, 75, 75); //gray
innerPaint.setAntiAlias(true);

borderPaint = new Paint();
borderPaint.setARGB(255, 255, 255, 255);
borderPaint.setAntiAlias(true);
borderPaint.setStyle(Style.STROKE);
borderPaint.setStrokeWidth(2);
}

public void setInnerPaint(Paint innerPaint) {
this.innerPaint = innerPaint;
}

public void setBorderPaint(Paint borderPaint) {
this.borderPaint = borderPaint;
}

@Override
public boolean onTouchEvent(MotionEvent



Other Threads

1. Support Of HID device role in the Android

Hi Folks,

I am working on the requirements to support the Android Phone to
communicate with the other Bluetooth device through the HID proifle in
the HID device mode.

As per my knowledge only HID Host mode is suppported in the Android
device.I need to support the Android Phones in the HID device  mode.

Please guide me how to achieve this.Whether it is feasible or not? If
yes what changes I have to do?

Thanks,
Shekhar

-- 

2. Nexus S and gingerbread Sensor events 鈥?Which sensor uses what hardware ?

Could someone help to know which sensor uses which part of phone's
hardware or in what combination of this on Nexus S in android 2.3 ?

Following are the sensor events:

TYPE_ACCELEROMETER

TYPE_GYROSCOPE

TYPE_GRAVITY

TYPE_LINEAR_ACCELERATION

TYPE_ORIENTATION

TYPE_ROTATION_VECTOR

I assume first 2 corresponds to separate hardware (accelerometer and
gyroscope),

but how with the other remaining ones ?

Does TYPE_LINEAR_ACCELERATION uses both Acceleromter and Gyroscope
hardware at its best?

I am actually interested in "linear aceleration" so should I need not
worry about gyro events, if "linear acceleration" internally uses gyro
to give out values ?

Also when tested on device ( Nexus S ) linear accelerations found to
give high values for minor shakes , so assuming this removes gravity
vector, this was not expected.

Thanks.

-- 

3. [WTA] help gimana caranya uninstall

4. Budget 2,5 - 3.0 pilih SAMSUNG ACE atau ada rekomendasi lain.please help

5. why can't catch the SocketTimeoutException

6. Set wallpaper from webview

7. Multiple content providers to sync...