How to use mouse event(onmousemove) in Android WebView?

by seri » Fri, 06 Mar 2009 05:19:39 GMT


Sponsored Links
 On iPhone, This is donw with addtional events
(ontouchmove,ontouchstart,ontouchend)
I know that these are only available in iPhone Safari.

Is There any way to control by touch event(onmousemove)?
How to use mouse event in WebView or Browser ?

-----------------------------------------------------------------------------------------------------
<html>
<head>
<title> Event </title>
<style>
.drag { position: relative; cursor:move }
</style>
<script language="JavaScript">
<!--
var bdown = false;
var x, y;
var sElem;

function mdown() {
 if(event.srcElement.className == "drag") {
  bdown = true;
  sElem = event.srcElement;
  x = event.clientX;
  y = event.clientY;
 }
}
function mup() {
 bdown = false;
}
function moveimg() {

 if(bdown)
 {

  var distX = event.clientX - x;
  var distY = event.clientY - y;
  sElem.style.pixelLeft += distX;
  sElem.style.pixelTop += distY;
  x = event.clientX;
  y = event.clientY;

 return false;
 }
}

document.onmousedown  = mdown;
document.onmouseup  = mup;
document.onmousemove  = moveimg;

//-->
</script>
</head>

<body>


<img src=" http://farm1.static.flickr.com/52/157145833_958fb267a2.jpg? 
v=0" class="drag">

</body>
</html>


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



How to use mouse event(onmousemove) in Android WebView?

by seri » Fri, 06 Mar 2009 05:19:44 GMT


 On iPhone, This is done with new additional events
(ontouchmove,ontouchstart,ontouchstart).
I know that these are not available in Android.

How can I use mouse event(onmousemove) in Android WebView or Browser?

-----------------------------------------------------------------------------------------
<html>
<head>
<title> New Document </title>
<style>
.drag { position: relative; cursor:move }
</style>
<script language="JavaScript">
<!--
var bdown = false;
var x, y;
var sElem;

function mdown() {
 if(event.srcElement.className == "drag") {
  bdown = true;
  sElem = event.srcElement;
  x = event.clientX;
  y = event.clientY;
 }
}
function mup() {
 bdown = false;
}
function moveimg() {

 if(bdown)
 {

  var distX = event.clientX - x;
  var distY = event.clientY - y;
  sElem.style.pixelLeft += distX;
  sElem.style.pixelTop += distY;
  x = event.clientX;
  y = event.clientY;

 return false;
 }
}



document.onmousedown  = mdown;
document.onmouseup  = mup;
document.onmousemove  = moveimg;

//-->
</script>
</head>

<body>


<img src=" http://farm1.static.flickr.com/52/157145833_958fb267a2.jpg? 
v=0" class="drag">

</body>
</html>


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


Sponsored Links


Other Threads

1. uninstall Popup Questions dialog

Sometimes when I uninstall an app, I get a popup dialog that asks me to tell 
it why I'm uninstalling.

Does anyone know if this is built into the market or if its a custom 
component?
If its built into the market, can we acces the data?

On average I get about a 60-70% retention on my keyboards but I'm interested 
in finding out why the other 30% of users cancel the purchase/uninstall.
It looks like its a locale issue for them and less often a device 
compatibility issue, but I'm only guessing based on analytics.

- Brill Pappin


-- 

2. Getting Owner and Contact Data

Hello,

I'm writing an app on to make use of the owner's data (first, last,
email(s), phone(s)) and one or more contacts the owner can choose. The
application will find common patterns and whatnot.

I have given my app READ_CONTACTS, WRITE_CONTACTS, READ_OWNER_DATA,
WRITE_OWNER_DATA permissions in my AndroidManifest.xml

Initially I used the People class which was deprecated, then I
switched to ContactsContract.Contacts...
to try pull explicitly the first (given), middle, and last (family)
names, then phone numbers, emails, etc... but I cannot seem to be able
to fetch these columns via:

Cursor c1 =
getContentResolver().query(ContactsContract.Data.CONTENT_URI, null,
ContactsContract.CommonDataKinds.StructuredName.CONTACT_ID +" = ?",
new String[]{id}, null);

Or even this

Cursor cc =
getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
null, null,null, null);
if (cc.moveToFirst()){
                        String [] names = cc.getColumnNames();
                        for (int j=0; j<names.length; j++){
                                Log.d("Contacts", "COL NAME:
"+names[j]);
                                Log.d("Contacts", "========>COL VALUE:
" +cc.getString(cc.getColumnIndexOrThrow(names[j]))+"\n\n");
                        }

                }

to show all column names but I'm not getting any relevant information.
I can get the phone number (data 0 or data 1), but not first, middle,
and last. I need to access as much of the user's data for the
algorithm to work as it compares it with other people to find trends
and patterns. The more complete the data the better.

Here's another alternative way I tried with the first cursor c1:

String lookup =
c1.getString(c.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
Cursor cc =
getContentResolver().query( 
Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI,
lookup), null, null, null, null);

and still I cannot get the owner's or a contact's data that I want.

Does anyone have any clue as to why I can't get the contact fields I
need... or how I can get them?

I really appreciate any insights.
Thanks!

--

3. Redrawing a view when the transparent activity closes

4. retrieve current shadow effect attributes from a textview

5. How to go to previous page..?

6. How to Add Mkv Support of Gingerbread to Froyo

7. unlock phone on camera detail view, the display flash twice