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. How to cache mapview tiles?

As MapView class doc indicates:

"Tiles are cached on the filesystem in your application's directory.
The cache is auto-managed so you don't need to do anything with it,
and can delete it at any time. "

but my application cannot cache tiles, it always download map data
from server when launched.
and i can't found "cache" directory in my application directory. is
there something i missed?

--~--~---------~--~----~------------~-------~--~----~

2. Where is the aapt.exe in SDK 1.5 and 1.6

Hi,
I delete R.java occasionally, and the project does not work now.
Dev Guide tells me:
Using aapt

*aapt* stands for Android Asset Packaging Tool and is included in the
tools/directory of the SDK.This tool allows you to view, create, and
update Zip-compatible archives
(zip, jar, apk). It can also compile resources into binary assets.

Though you probably won't often use *aapt* directly, build scripts and IDE
plugins can utilize this tool to package the apk file that constitutes an
Android application.

For more usage details, open a terminal, go to the tools/ directory, and run
the command:

   -

   Linux or Mac OS X:

   ./aapt

   -

   Windows:

   aapt.exe


but I can't find aapt.exe in SDK1.5 and 1.6.
where is it now or where I can get it? Thanks~

--~--~---------~--~----~------------~-------~--~----~

3. concerned about beta testers - what's your take on this?

4. how to enumerate all character sets supported by android platform?

5. CPhone To Rival OPhone, iPhone

6. Anyone use SIM5210 as baseband module?

7. the rooted G1 phone == the dev phone == the unlock G1 phone ?