[android-developers] Re: drag and drop in case of view flipper

2012-05-03 Thread Narendra Singh Rathore
On Thu, May 3, 2012 at 10:30 AM, Narendra Singh Rathore 
nsr.curi...@gmail.com wrote:

 Hi all,
  what I am doing is just dragging items from grid view and dropping them
 to gallery view one by one.
 All is working fine in this case.

 But now, I need that initially, when my gallery is empty, *I want to show
 some text in place of that gallery.
 For that purpose, I am using viewFlipper in my xml, containing gallery and
 textview. TextView should appear only in the case Gallery is empty.

 In that case, after dropping one image from gridview to gallery, I am
 unable to drop any other image onto gallery.*
 I even tried FrameLayout in place of ViewFlipper, but even that didn't
 work for me.

 Here are both the layouts - before using ViewFlipper, and after using
 viewFlipper, as follows:

 *This is the initial layout without ViewFlipper*

 ?xml version=1.0 encoding=utf-8?
 RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android;
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical


 com.views.DraggableView
  android:id=@+id/draggingView1
  android:layout_width=150dip
  android:layout_height=150dip
  android:src=@drawable/ic_launcher

  android:scaleType=fitXY
 /com.views.DraggableView


 LinearLayout xmlns:android=
 http://schemas.android.com/apk/res/android;
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical
 android:weightSum=10


 com.views.GridViewDragDrop
 android:id=@+id/gridViewDragDrop
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=7
 android:numColumns=3
 
 /com.views.GridViewDragDrop
  LinearLayout android:layout_width=fill_parent
  android:layout_height=1dp
  android:background=#ff/

 LinearLayout xmlns:android=
 http://schemas.android.com/apk/res/android;
 android:layout_width=fill_parent
 android:orientation=horizontal
 android:weightSum=10
 android:layout_height=0dp
 android:layout_weight=2
 

 ImageView
 android:id=@+id/imgArrowLeft_sld
 android:layout_weight=1
 android:layout_width=0dp
 android:layout_height=wrap_content
 android:layout_gravity=center
 android:src=@drawable/arrow_left /


 com.views.GallaryDragDrop
 android:id=@+id/gallery

 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:spacing=.1px
 android:layout_weight=8
/

 TextView
 android:layout_width=wrap_content
 android:layout_height=wrap_content/


 ImageView
 android:id=@+id/imgArrowRight_sld
 android:layout_weight=1
 android:layout_width=0dp
android:layout_gravity=center
 android:layout_height=wrap_content
 android:src=@drawable/arrow_right /
 /LinearLayout





 /LinearLayout

 /RelativeLayout


 *This is the layout using ViewFlipper*

 ?xml version=1.0 encoding=utf-8?
 RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android;
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical


 com.views.DraggableView
  android:id=@+id/draggingView1
  android:layout_width=150dip
  android:layout_height=150dip
  android:src=@drawable/ic_launcher

  android:scaleType=fitXY
 /com.views.DraggableView


 LinearLayout xmlns:android=
 http://schemas.android.com/apk/res/android;
 android:layout_width=fill_parent
 android:layout_height=fill_parent
 android:orientation=vertical
 android:weightSum=10


 com.views.GridViewDragDrop
 android:id=@+id/gridViewDragDrop
 android:layout_width=fill_parent
 android:layout_height=0dp
 android:layout_weight=7
 android:numColumns=3
 
 /com.views.GridViewDragDrop
  LinearLayout android:layout_width=fill_parent
  android:layout_height=1dp
  android:background=#ff/

 LinearLayout xmlns:android=
 http://schemas.android.com/apk/res/android;
 android:layout_width=fill_parent
 android:orientation=horizontal
 android:weightSum=10
 android:layout_height=0dp
 android:layout_weight=2
 

 ImageView
 android:id=@+id/imgArrowLeft_sld
 android:layout_weight=1
 

[android-developers] Re: drag and drop view in android?

2011-03-18 Thread blahti
I studied the drag and drop code in the Launcher and really liked it.
So I built an example that includes what I thought were the essential
elements of their design. For source code and a write-up; go here:

http://blahti.wordpress.com/2011/01/17/moving-views-part-2/



On Mar 15, 8:24 pm, argongold argongol...@gmail.com wrote:
 This set of classes (drag  drop) in Launcher also use some Private
 API's and you can not compile them under your android SDK.

 argongold

 On Mar 15, 11:04 am, 曾少彬 forever_ho...@hotmail.com wrote:

  You can referer to android source/packages/apps/Launcher, there is a set 
  of classes to support drag  drop.

   Date: Mon, 14 Mar 2011 19:27:42 -0700
   Subject: [android-developers] Re: drag and drop view in android?
   From: lancaster.dambust...@gmail.com
   To: android-developers@googlegroups.com

   This probably won't help most people, but Honeycomb includes a drag
   and drop framework.

   On Mar 14, 5:48 am, TreKing treking...@gmail.com wrote:
On Mon, Mar 14, 2011 at 5:59 AM, Hitendrasinh Gohil 

hitendra.virtuei...@gmail.com wrote:
 i  want reordering of the list row by drag and drop.
 means if i drag first row and drop at 5th position the view should
 be updated.

   http://tinyurl.com/6eqvtp9

---
 --
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


RE: [android-developers] Re: drag and drop view in android?

2011-03-15 Thread 曾少彬

You can referer to android source/packages/apps/Launcher, there is a set of 
classes to support drag  drop.


 Date: Mon, 14 Mar 2011 19:27:42 -0700
 Subject: [android-developers] Re: drag and drop view in android?
 From: lancaster.dambust...@gmail.com
 To: android-developers@googlegroups.com
 
 This probably won't help most people, but Honeycomb includes a drag
 and drop framework.
 
 On Mar 14, 5:48 am, TreKing treking...@gmail.com wrote:
  On Mon, Mar 14, 2011 at 5:59 AM, Hitendrasinh Gohil 
 
  hitendra.virtuei...@gmail.com wrote:
   i  want reordering of the list row by drag and drop.
   means if i drag first row and drop at 5th position the view should
   be updated.
 
  http://tinyurl.com/6eqvtp9
 
  --- 
  --
  TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
  transit tracking app for Android-powered devices
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
  

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: drag and drop view in android?

2011-03-15 Thread argongold

This set of classes (drag  drop) in Launcher also use some Private
API's and you can not compile them under your android SDK.

argongold



On Mar 15, 11:04 am, 曾少彬 forever_ho...@hotmail.com wrote:
 You can referer to android source/packages/apps/Launcher, there is a set of 
 classes to support drag  drop.

  Date: Mon, 14 Mar 2011 19:27:42 -0700
  Subject: [android-developers] Re: drag and drop view in android?
  From: lancaster.dambust...@gmail.com
  To: android-developers@googlegroups.com

  This probably won't help most people, but Honeycomb includes a drag
  and drop framework.

  On Mar 14, 5:48 am, TreKing treking...@gmail.com wrote:
   On Mon, Mar 14, 2011 at 5:59 AM, Hitendrasinh Gohil 

   hitendra.virtuei...@gmail.com wrote:
i  want reordering of the list row by drag and drop.
means if i drag first row and drop at 5th position the view should
be updated.

  http://tinyurl.com/6eqvtp9

   ---
--
   TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
   transit tracking app for Android-powered devices

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: drag and drop view in android?

2011-03-14 Thread A. Elk
This probably won't help most people, but Honeycomb includes a drag
and drop framework.

On Mar 14, 5:48 am, TreKing treking...@gmail.com wrote:
 On Mon, Mar 14, 2011 at 5:59 AM, Hitendrasinh Gohil 

 hitendra.virtuei...@gmail.com wrote:
  i  want reordering of the list row by drag and drop.
  means if i drag first row and drop at 5th position the view should
  be updated.

 http://tinyurl.com/6eqvtp9

 --- 
 --
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: drag and drop view in android?

2011-03-14 Thread metal mikey
That's great and all TreKing, don't see what Google has to do with any
of this though, and you can't expect the OP to read the results for
himself. Can you please provide an automated search of this mailing
list for 'drag and drop' and summarise, fast-immediately-now.

Thanks

On Mar 14, 11:48 pm, TreKing treking...@gmail.com wrote:
 On Mon, Mar 14, 2011 at 5:59 AM, Hitendrasinh Gohil 

 hitendra.virtuei...@gmail.com wrote:
  i  want reordering of the list row by drag and drop.
  means if i drag first row and drop at 5th position the view should
  be updated.

 http://tinyurl.com/6eqvtp9

 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Drag and Drop

2011-02-22 Thread blahti
 Can any one help in that?

I have been looking into drag and drop too. I had found a post that
pointed me at the Google Launcher code. That's a good thing to study.
I built a few simple examples and wrote them up on my blog. See
http://blahti.wordpress.com/2011/02/10/moving-views-part-3/.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Drag and Drop

2011-02-17 Thread Oded O.
Maybe this will help:
http://code.google.com/p/mobile-anarchy-widgets/wiki/Drag_and_Drop

Regards,
Oded

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Drag and Drop

2011-02-17 Thread Sunil Lakhiyani
Thank you Oded, and Treking. You saved my time [?].
At least I got where to start.
I really appreciate your help.
Will soon update you with result.
--
Sunil Lakhiyani
+1 215 584 7289




On Thu, Feb 17, 2011 at 1:20 AM, Oded O. olb...@gmail.com wrote:

 Maybe this will help:
 http://code.google.com/p/mobile-anarchy-widgets/wiki/Drag_and_Drop

 Regards,
 Oded

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en330.gif

[android-developers] Re: Drag and drop in a web application?

2011-02-11 Thread Keith Hughitt
Okay I found a solution which maps touch events to mouse events and seems to 
do the trick. In case anyone is interested, here is the link:

http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Drag and Drop List Simple Example

2010-11-01 Thread ericharlow
I like those links too. Good Stuff.

On Oct 31, 7:55 pm, Mathias Lin m...@mathiaslin.com wrote:
 Thanks for sharing.
 Can also look 
 athttp://stackoverflow.com/questions/2909311/android-list-view-drag-and...http://github.com/commonsguy/cwac-touchlist
 for another example

 On Nov 1, 8:33 am, ericharlow eric.b.har...@gmail.com wrote:

  I struggled with finding and using a simple drag and drop list. I
  figured others would be looking for the same type of thing since
  android doesn't currently provide one. A simple Drag and Drop List
  Example can be found 
  athttp://ericharlow.blogspot.com/2010/10/experience-android-drag-and-dr
  Hope this is helpful to others.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Drag and Drop List Simple Example

2010-10-31 Thread Mathias Lin
Thanks for sharing.
Can also look at
http://stackoverflow.com/questions/2909311/android-list-view-drag-and-drop-sort
http://github.com/commonsguy/cwac-touchlist
for another example

On Nov 1, 8:33 am, ericharlow eric.b.har...@gmail.com wrote:
 I struggled with finding and using a simple drag and drop list. I
 figured others would be looking for the same type of thing since
 android doesn't currently provide one. A simple Drag and Drop List
 Example can be found 
 athttp://ericharlow.blogspot.com/2010/10/experience-android-drag-and-dr
 Hope this is helpful to others.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: drag and drop table rows?

2010-01-02 Thread sergej
Yes, it's possible, but you have to handle it by yourself. Just have a
look into TouchInterceptor.java class located within Music package of
Android sources. I have written my implementation after I learned how
android guys did it.

On Dec 30 2009, 5:59 am, Sean Neilan sneil...@gmail.com wrote:
 Is it possible to drag and drop table rows in android? Say the user
 holds down on a table row, the row would would become transparent and
 be draggable around the screen  then depending where the user dropped
 it, the table row would be inserted there.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: drag and drop table rows?

2009-12-30 Thread Chris McClanahan
I don't know *how* it's being done, but I believe what you are talking
about is in the Quick Settings app [http://beworx.com/bequick/], so
maybe ask him?

On Dec 29, 11:59 pm, Sean Neilan sneil...@gmail.com wrote:
 Is it possible to drag and drop table rows in android? Say the user
 holds down on a table row, the row would would become transparent and
 be draggable around the screen  then depending where the user dropped
 it, the table row would be inserted there.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Drag and Drop

2009-12-19 Thread Wouter
How can I create a list where I can rearrange list items with dragging
list rows to another row and so on (to change to order)?

Just like on the HTC Hero in the clocks app where you can rearrange
the order of clocks?

Wouter

On Dec 18, 11:08 pm, Business Talk roman.businesst...@gmail.com
wrote:
 Thanks Mark

 On Dec 18, 4:37 pm, Mark Murphy mmur...@commonsware.com wrote:

  Business Talk wrote:
   is there any drag and drop support in android? Couldn't find any

  Nothing really built in, though with touch events and such you could
  create something that works for your app.

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://twitter.com/commonsguy

  Android Training in US: 11-15 January 2010:http://onlc.com

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Drag and Drop

2009-12-18 Thread Business Talk
Thanks Mark

On Dec 18, 4:37 pm, Mark Murphy mmur...@commonsware.com wrote:
 Business Talk wrote:
  is there any drag and drop support in android? Couldn't find any

 Nothing really built in, though with touch events and such you could
 create something that works for your app.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android Training in US: 11-15 January 2010:http://onlc.com

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Drag and Drop from Source View to Target View

2009-09-17 Thread Mark Murphy

Raman wrote:
 If anyone of you ever faced a similar scenario, please let me know
 because I could not find a direct support to such a thing (Drag and
 Drop) in the platform, so may be I need to find an innovative solution
 to it.

The home screen does something similar with widgets, and other home
implement the same sort of thing. Look at the Android source code, find
the home screen, and see how it pulls off drag-and-drop for its case --
you may be able to adapt the technique for your scenario.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 In Print!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Drag and Drop from Source View to Target View

2009-09-17 Thread Raman

Hi Mark,

Thanks for your reply. I saw the behaviour you are talking about. If I
am not wrong, you are talking about the ability to drag the
application icons on the home screen to different locations. I am also
able to achieve that, but, unfortunately, that is not what I want. The
feature that you are talking about only involves changing the position
of a View, while my requirement is to find out the View over which the
movable View is dropped. Please note that on the basis of which target
view, it is dropped at, I need to do a particular task.
So effectively, this problem is reduced to finding the View from the
coordinates to which it is dropped or may be some better solution.
Do You have any idea for how to go for this...

Thanks.
- Raman


On Sep 17, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote:

 The home screen does something similar with widgets, and other home
 implement the same sort of thing. Look at the Android source code, find
 the home screen, and see how it pulls off drag-and-drop for its case --
 you may be able to adapt the technique for your scenario.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Drag and Drop from Source View to Target View

2009-09-17 Thread Mark Murphy

Raman wrote:
 my requirement is to find out the View over which the
 movable View is dropped. Please note that on the basis of which target
 view, it is dropped at, I need to do a particular task.
 So effectively, this problem is reduced to finding the View from the
 coordinates to which it is dropped or may be some better solution.

Ah. Sorry, I have no idea if that is even possible.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coders' Guide to *Advanced* Android Development_ In Print!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-02-17 Thread vistodavid

By using these solution, I can drag my custom view, my problem is
that how to make this custom view rotate in specified degree?
Its parent class View doesn't have a rotate method, I tried to use
its inside canvas, but it seems that just the canvas rotate, but the
custom view doesn't rotate, that's not what I want, does anyone who
knows or have any clues, please reply.
Thanks for reply in advance!

Br,
-Yajun

On Jan 12, 2:57 pm, kaushik sur kaushik@gmail.com wrote:
 yes dianne and peli , both of u r right. and so i am digging into the
 launcher code and getting good result out of that.

 regards
 kaushik

 On Sun, Jan 11, 2009 at 8:04 AM, Dianne Hackborn hack...@android.comwrote:



  Fwiw, changing layout parameters is a really inefficient way to do
  animations on the screen.  I would strongly suggest looking at the launcher
  code and doing something inspired by that.

  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com

  Note: please don't send private questions to me, as I don't have time to
  provide private support.  All such questions should be posted on public
  forums, where I and others can see and answer them.- Hide quoted text -

 - Show quoted text -

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-11 Thread kaushik sur
yes dianne and peli , both of u r right. and so i am digging into the
launcher code and getting good result out of that.

regards
kaushik

On Sun, Jan 11, 2009 at 8:04 AM, Dianne Hackborn hack...@android.comwrote:

 Fwiw, changing layout parameters is a really inefficient way to do
 animations on the screen.  I would strongly suggest looking at the launcher
 code and doing something inspired by that.

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them.



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-10 Thread kaushik sur
hi Peli

thank you very much for giving me the correct direction.

regards
Kaushik

On Fri, Jan 9, 2009 at 7:58 PM, Peli peli0...@googlemail.com wrote:


 Introduce new member variables of your class:
 int mOffsetX;
 int mOffsetY;


 Then below you do something like:

 if ( action == MotionEvent.ACTION_DOWN ) {
 System.out.println(X=+mCurX+  y=+mCurY);
this.setText(x:  + mCurX + ,y:  + mCurY );

 mOffsetX = mCurX - 10; // 10 was the initial coordinate
mOffsetY = mCurY - 10;

   } else if ( action == MotionEvent.ACTION_MOVE ) {
 System.out.println(X=+mCurX+  y=+mCurY);
this.setText(x:  + mCurX + ,y:  + mCurY );
AbsoluteLayout.LayoutParams p = new
AbsoluteLayout.LayoutParams
 (AbsoluteLayout.LayoutParams.WRAP_CONTENT,
  AbsoluteLayout.LayoutParams.WRAP_CONTENT,this.getScrollX()+
 mCurX + mOffsetX,
  this.getScrollY()+mCurY + mOffsetY);  Here you add the
 offset values.
this.setLayoutParams (p);

   }

 I hope this helps as a pointer. Note that after you placed the object
 to a new position, you have to remember the new coordinates (instead
 of (10,10) where you started originally).

 ACTION_DOWN is called when you click the mouse button, ACTION_MOVE is
 called while you click and drag, and ACTION_UP is called when you
 release the mouse button. Replace mouse by finger on the actual
 device :-)

 I hope this is what you meant.

 Peli
 www.openintents.org


 On Jan 9, 2:46 pm, kaushik sur kaushik@gmail.com wrote:
  hi
 
  Can you please illustrate the scenarios of the constants
  ACTION_MOVE,ACTION_DOWN,ACTION_UP ?
 
  regards
  Kaushik
 
  On Fri, Jan 9, 2009 at 6:22 PM, Peli peli0...@googlemail.com wrote:
 
   what you have to do is, remember the coordinates that you get with the
   ACTION_DOWN event.
 
   Remember the distance (difference) between those coordinates and the
   original coordinates of your image (call that offsetX and offsetY),
   and subsequently in ACTION_MOVE always add those offset values.
 
   Peli
 
   On Jan 9, 11:36 am, kaushik sur kaushik@gmail.com wrote:
Hi Peli
 
here i attach my code, to be added , i have ressolved the issue of
 double
image by getting rawX() value of the event , and setting my absolute
   layout
according to that.
but here i get a unique problem, whenever i click the button and try
 to
   drag
it, the mouse tip comes to a certain pixels above from the topleft
 corner
   of
the button,like a offset distance,if you run the code on the emulator
 u
   wil
find this problem.
can anyone help to solve this?
 
package com.google.android.samples.view.draganddrop;
 
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.os.Bundle;
import android.view.MotionEvent ;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AbsoluteLayout;
import android.widget.Button;
import android.widget.Toast;
 
public class Drag_And_Drop extends Activity {
 /** Called when the activity is first created. */
 
 @Override
 public void onCreate(Bundle icicle) {
  super.onCreate(icicle);
 
  MyView tx = new MyView(this);
  tx.setText(Drag Me);
  AbsoluteLayout l = new AbsoluteLayout(this);
 
  AbsoluteLayout.LayoutParams p = new AbsoluteLayout.LayoutParams(
AbsoluteLayout.LayoutParams.WRAP_CONTENT,
AbsoluteLayout.LayoutParams.WRAP_CONTENT,10,10);
  l.addView(tx,p);
  setContentView(l);
 
 }
 
 class MyView extends Button
 {
  public MyView(Context c){
   super(c);
 
  }
 
  @Override
  public boolean dispatchTouchEvent(MotionEvent event) {
   intmCurX=(int)event.getRawX();
   int mCurY=(int)event.getRawY();;
   System.out.println(scrollx +this.getScrollX());
   int action = event.getAction();
   if ( action == MotionEvent.ACTION_MOVE ) {
System.out.println(X=+mCurX+  y=+mCurY);
this.setText(x:  + mCurX + ,y:  + mCurY );
AbsoluteLayout.LayoutParams p = new
   
 AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,
  AbsoluteLayout.LayoutParams.WRAP_CONTENT,this.getScrollX()+
 mCurX,
  this.getScrollY()+mCurY);
this.setLayoutParams (p);
 
   }
   return true;
  }
 
  @Override
  public void draw(Canvas canvas) {
   // TODO Auto-generated method stub
   super.draw(canvas);
 
  }
 
 }
 
}
 
#main.xml#
 
?xml version=*1.0* encoding=*utf-8*?
 
LinearLayout xmlns:android=*
 http://schemas.android.com/apk/res/android
   
*
 
android:orientation=*vertical
*
 
android:layout_width=*fill_parent
*
 
android:layout_height=*fill_parent
*
 
TextView
 
android:layout_width=*fill_parent*
 
android:layout_height=*wrap_content*
 
android:text=*@string/hello
*
 
/
 
Button
 
android:id=*@+id/button
  

[android-developers] Re: DRAG AND DROP

2009-01-10 Thread Dianne Hackborn
Fwiw, changing layout parameters is a really inefficient way to do
animations on the screen.  I would strongly suggest looking at the launcher
code and doing something inspired by that.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-09 Thread Peli

I don't know what your final code looks like that you use, but you can
change the visibility of the original item you are dragging
temporarily using setVisibility(View.INVISIBLE) or View.GONE depending
on how your layout is organized, so that only one item is visible
while dragging.

You could post your code here if you need further help.

Peli

On 9 Jan., 08:41, kaushik sur kaushik@gmail.com wrote:
 hi all

 i have mentioned about a code link which can be used as an e.g. of the
 Drag_N_Drop feature, but there will be small change.
 the onMotionEvent(MotionEvent event) has to be replaced by
 onTouchEvent(MotionEvent event).
 though it starts the Drag_n_drop but it not smooth as u expect.
 rather here i am getting a abnormal behavior,i.e, i am getting double image
 of the button, that i drag and drop,Can anyone run the code sample and solve
 the issue...?

 regards
 Kaushik

 On Fri, Jan 9, 2009 at 2:39 AM, Peli peli0...@googlemail.com wrote:

  which can be found here:

 http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;...
  with the related classes being here:

 http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;...

  but this is the luxury version, including scaling of the image, scroll
  zones, and vibration :-)

  Peli

  On Jan 8, 8:16 pm, Romain Guy romain...@google.com wrote:
   You can also look at the source code of the Home (Launcher)
   application, in particular the class called DragLayer.

    On Thu, Jan 8, 2009 at 11:12 AM, Peli peli0...@googlemail.com wrote:

The code sample you linked to should work.

The basic idea is that you continuously put your image to a new
position according to the coordinates that you obtain through
ACTION_MOVE to give the illusion of dragging.
In ACTION_UP you check whether the finger position is close to the
target.
in ACTION_DOWN you can remember the initial finger coordinates so that
you can grab your icon everywhere correctly.

Basically you have to code everything by yourself, but it should not
be very difficult.

Peli
   www.openintents.org

On Jan 8, 7:06 pm, kaushik sur kaushik@gmail.com wrote:
hi

i got a suggestion here. but i really doubt whether it will work or
  not.http://groups.google.com/group/android-beginners/browse_thread/thread.
  ..

please give me a valid reasoning or example.

regards
Kaushik

On Thu, Jan 8, 2009 at 9:43 PM, kaushik.siso kaushik@gmail.com
  wrote:

 hi

 i want to know how can i enbale Drag and drop feature in android.
 suppose i have a image,which are to be dragged and dropped on
  another
 result and it will start a new activity.
 i seek your help to  get a head-start atleast.

 regards
 k...@sis

   --
   Romain Guy
   Android framework engineer
   romain...@android.com

   Note: please don't send private questions to me, as I don't have time
   to provide private support.  All such questions should be posted on
   public forums, where I and others can see and answer them
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-09 Thread Dan Raaka

Refer Launcher code in the source tree.

-M

On Jan 8, 8:13 am, kaushik.siso kaushik@gmail.com wrote:
 hi

 i want to know how can i enbale Drag and drop feature in android.
 suppose i have a image,which are to be dragged and dropped on another
 result and it will start a new activity.
 i seek your help to  get a head-start atleast.

 regards
 k...@sis

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-09 Thread kaushik sur
Hi Peli

here i attach my code, to be added , i have ressolved the issue of double
image by getting rawX() value of the event , and setting my absolute layout
according to that.
but here i get a unique problem, whenever i click the button and try to drag
it, the mouse tip comes to a certain pixels above from the topleft corner of
the button,like a offset distance,if you run the code on the emulator u wil
find this problem.
can anyone help to solve this?


package com.google.android.samples.view.draganddrop;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.os.Bundle;
import android.view.MotionEvent ;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AbsoluteLayout;
import android.widget.Button;
import android.widget.Toast;

public class Drag_And_Drop extends Activity {
 /** Called when the activity is first created. */

 @Override
 public void onCreate(Bundle icicle) {
  super.onCreate(icicle);

  MyView tx = new MyView(this);
  tx.setText(Drag Me);
  AbsoluteLayout l = new AbsoluteLayout(this);

  AbsoluteLayout.LayoutParams p = new AbsoluteLayout.LayoutParams(
AbsoluteLayout.LayoutParams.WRAP_CONTENT,
AbsoluteLayout.LayoutParams.WRAP_CONTENT,10,10);
  l.addView(tx,p);
  setContentView(l);

 }

 class MyView extends Button
 {
  public MyView(Context c){
   super(c);

  }

  @Override
  public boolean dispatchTouchEvent(MotionEvent event) {
   intmCurX=(int)event.getRawX();
   int mCurY=(int)event.getRawY();;
   System.out.println(scrollx +this.getScrollX());
   int action = event.getAction();
   if ( action == MotionEvent.ACTION_MOVE ) {
System.out.println(X=+mCurX+  y=+mCurY);
this.setText(x:  + mCurX + ,y:  + mCurY );
AbsoluteLayout.LayoutParams p = new
AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,
  AbsoluteLayout.LayoutParams.WRAP_CONTENT,this.getScrollX()+ mCurX,
  this.getScrollY()+mCurY);
this.setLayoutParams (p);

   }
   return true;
  }

  @Override
  public void draw(Canvas canvas) {
   // TODO Auto-generated method stub
   super.draw(canvas);

  }

 }

}

#main.xml#

?xml version=*1.0* encoding=*utf-8*?

LinearLayout xmlns:android=*http://schemas.android.com/apk/res/android;
*

android:orientation=*vertical
*

android:layout_width=*fill_parent
*

android:layout_height=*fill_parent
*



TextView

android:layout_width=*fill_parent*

android:layout_height=*wrap_content*

android:text=*@string/hello
*

/

Button

android:id=*@+id/button
*

android:layout_width=*fill_parent
*

android:layout_height=*wrap_content
*

android:text=*start transfer
*

/

/LinearLayout



regards
Kaushik

On Thu, Jan 8, 2009 at 11:23 PM, Dan Raaka micromys...@gmail.com wrote:


 Refer Launcher code in the source tree.

 -M

 On Jan 8, 8:13 am, kaushik.siso kaushik@gmail.com wrote:
  hi
 
  i want to know how can i enbale Drag and drop feature in android.
  suppose i have a image,which are to be dragged and dropped on another
  result and it will start a new activity.
  i seek your help to  get a head-start atleast.
 
  regards
  k...@sis

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-09 Thread Peli

what you have to do is, remember the coordinates that you get with the
ACTION_DOWN event.

Remember the distance (difference) between those coordinates and the
original coordinates of your image (call that offsetX and offsetY),
and subsequently in ACTION_MOVE always add those offset values.

Peli

On Jan 9, 11:36 am, kaushik sur kaushik@gmail.com wrote:
 Hi Peli

 here i attach my code, to be added , i have ressolved the issue of double
 image by getting rawX() value of the event , and setting my absolute layout
 according to that.
 but here i get a unique problem, whenever i click the button and try to drag
 it, the mouse tip comes to a certain pixels above from the topleft corner of
 the button,like a offset distance,if you run the code on the emulator u wil
 find this problem.
 can anyone help to solve this?

 package com.google.android.samples.view.draganddrop;

 import android.app.Activity;
 import android.content.Context;
 import android.graphics.Canvas;
 import android.os.Bundle;
 import android.view.MotionEvent ;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.AbsoluteLayout;
 import android.widget.Button;
 import android.widget.Toast;

 public class Drag_And_Drop extends Activity {
  /** Called when the activity is first created. */

 �...@override
  public void onCreate(Bundle icicle) {
   super.onCreate(icicle);

   MyView tx = new MyView(this);
   tx.setText(Drag Me);
   AbsoluteLayout l = new AbsoluteLayout(this);

   AbsoluteLayout.LayoutParams p = new AbsoluteLayout.LayoutParams(
     AbsoluteLayout.LayoutParams.WRAP_CONTENT,
     AbsoluteLayout.LayoutParams.WRAP_CONTENT,10,10);
   l.addView(tx,p);
   setContentView(l);

  }

  class MyView extends Button
  {
   public MyView(Context c){
    super(c);

   }

   @Override
   public boolean dispatchTouchEvent(MotionEvent event) {
    int    mCurX=(int)event.getRawX();
    int mCurY=(int)event.getRawY();;
    System.out.println(scrollx +this.getScrollX());
    int action = event.getAction();
    if ( action == MotionEvent.ACTION_MOVE ) {
     System.out.println(X=+mCurX+  y=+mCurY);
     this.setText(x:  + mCurX + ,y:  + mCurY );
     AbsoluteLayout.LayoutParams p = new
     AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,
       AbsoluteLayout.LayoutParams.WRAP_CONTENT,this.getScrollX()+ mCurX,
       this.getScrollY()+mCurY);
     this.setLayoutParams (p);

    }
    return true;
   }

   @Override
   public void draw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.draw(canvas);

   }

  }

 }

 #main.xml#

 ?xml version=*1.0* encoding=*utf-8*?

 LinearLayout xmlns:android=*http://schemas.android.com/apk/res/android;
 *

 android:orientation=*vertical
 *

 android:layout_width=*fill_parent
 *

 android:layout_height=*fill_parent
 *



 TextView

 android:layout_width=*fill_parent*

 android:layout_height=*wrap_content*

 android:text=*@string/hello
 *

 /

 Button

 android:id=*@+id/button
 *

 android:layout_width=*fill_parent
 *

 android:layout_height=*wrap_content
 *

 android:text=*start transfer
 *

 /

 /LinearLayout

 regards
 Kaushik

 On Thu, Jan 8, 2009 at 11:23 PM, Dan Raaka micromys...@gmail.com wrote:

  Refer Launcher code in the source tree.

  -M

  On Jan 8, 8:13 am, kaushik.siso kaushik@gmail.com wrote:
   hi

   i want to know how can i enbale Drag and drop feature in android.
   suppose i have a image,which are to be dragged and dropped on another
   result and it will start a new activity.
   i seek your help to  get a head-start atleast.

   regards
   k...@sis
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-09 Thread kaushik sur
hi

Can you please illustrate the scenarios of the constants
ACTION_MOVE,ACTION_DOWN,ACTION_UP ?

regards
Kaushik

On Fri, Jan 9, 2009 at 6:22 PM, Peli peli0...@googlemail.com wrote:


 what you have to do is, remember the coordinates that you get with the
 ACTION_DOWN event.

 Remember the distance (difference) between those coordinates and the
 original coordinates of your image (call that offsetX and offsetY),
 and subsequently in ACTION_MOVE always add those offset values.

 Peli

 On Jan 9, 11:36 am, kaushik sur kaushik@gmail.com wrote:
  Hi Peli
 
  here i attach my code, to be added , i have ressolved the issue of double
  image by getting rawX() value of the event , and setting my absolute
 layout
  according to that.
  but here i get a unique problem, whenever i click the button and try to
 drag
  it, the mouse tip comes to a certain pixels above from the topleft corner
 of
  the button,like a offset distance,if you run the code on the emulator u
 wil
  find this problem.
  can anyone help to solve this?
 
  package com.google.android.samples.view.draganddrop;
 
  import android.app.Activity;
  import android.content.Context;
  import android.graphics.Canvas;
  import android.os.Bundle;
  import android.view.MotionEvent ;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.AbsoluteLayout;
  import android.widget.Button;
  import android.widget.Toast;
 
  public class Drag_And_Drop extends Activity {
   /** Called when the activity is first created. */
 
   @Override
   public void onCreate(Bundle icicle) {
super.onCreate(icicle);
 
MyView tx = new MyView(this);
tx.setText(Drag Me);
AbsoluteLayout l = new AbsoluteLayout(this);
 
AbsoluteLayout.LayoutParams p = new AbsoluteLayout.LayoutParams(
  AbsoluteLayout.LayoutParams.WRAP_CONTENT,
  AbsoluteLayout.LayoutParams.WRAP_CONTENT,10,10);
l.addView(tx,p);
setContentView(l);
 
   }
 
   class MyView extends Button
   {
public MyView(Context c){
 super(c);
 
}
 
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
 intmCurX=(int)event.getRawX();
 int mCurY=(int)event.getRawY();;
 System.out.println(scrollx +this.getScrollX());
 int action = event.getAction();
 if ( action == MotionEvent.ACTION_MOVE ) {
  System.out.println(X=+mCurX+  y=+mCurY);
  this.setText(x:  + mCurX + ,y:  + mCurY );
  AbsoluteLayout.LayoutParams p = new
  AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,
AbsoluteLayout.LayoutParams.WRAP_CONTENT,this.getScrollX()+ mCurX,
this.getScrollY()+mCurY);
  this.setLayoutParams (p);
 
 }
 return true;
}
 
@Override
public void draw(Canvas canvas) {
 // TODO Auto-generated method stub
 super.draw(canvas);
 
}
 
   }
 
  }
 
  #main.xml#
 
  ?xml version=*1.0* encoding=*utf-8*?
 
  LinearLayout xmlns:android=*http://schemas.android.com/apk/res/android
 
  *
 
  android:orientation=*vertical
  *
 
  android:layout_width=*fill_parent
  *
 
  android:layout_height=*fill_parent
  *
 
 
 
  TextView
 
  android:layout_width=*fill_parent*
 
  android:layout_height=*wrap_content*
 
  android:text=*@string/hello
  *
 
  /
 
  Button
 
  android:id=*@+id/button
  *
 
  android:layout_width=*fill_parent
  *
 
  android:layout_height=*wrap_content
  *
 
  android:text=*start transfer
  *
 
  /
 
  /LinearLayout
 
  regards
  Kaushik
 
   On Thu, Jan 8, 2009 at 11:23 PM, Dan Raaka micromys...@gmail.com
 wrote:
 
   Refer Launcher code in the source tree.
 
   -M
 
   On Jan 8, 8:13 am, kaushik.siso kaushik@gmail.com wrote:
hi
 
i want to know how can i enbale Drag and drop feature in android.
suppose i have a image,which are to be dragged and dropped on another
result and it will start a new activity.
i seek your help to  get a head-start atleast.
 
regards
k...@sis
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-09 Thread Peli

Introduce new member variables of your class:
int mOffsetX;
int mOffsetY;


Then below you do something like:

if ( action == MotionEvent.ACTION_DOWN ) {
System.out.println(X=+mCurX+  y=+mCurY);
this.setText(x:  + mCurX + ,y:  + mCurY );

mOffsetX = mCurX - 10; // 10 was the initial coordinate
mOffsetY = mCurY - 10;

   } else if ( action == MotionEvent.ACTION_MOVE ) {
System.out.println(X=+mCurX+  y=+mCurY);
this.setText(x:  + mCurX + ,y:  + mCurY );
AbsoluteLayout.LayoutParams p = new
AbsoluteLayout.LayoutParams
(AbsoluteLayout.LayoutParams.WRAP_CONTENT,
  AbsoluteLayout.LayoutParams.WRAP_CONTENT,this.getScrollX()+
mCurX + mOffsetX,
  this.getScrollY()+mCurY + mOffsetY);  Here you add the
offset values.
this.setLayoutParams (p);

   }

I hope this helps as a pointer. Note that after you placed the object
to a new position, you have to remember the new coordinates (instead
of (10,10) where you started originally).

ACTION_DOWN is called when you click the mouse button, ACTION_MOVE is
called while you click and drag, and ACTION_UP is called when you
release the mouse button. Replace mouse by finger on the actual
device :-)

I hope this is what you meant.

Peli
www.openintents.org


On Jan 9, 2:46 pm, kaushik sur kaushik@gmail.com wrote:
 hi

 Can you please illustrate the scenarios of the constants
 ACTION_MOVE,ACTION_DOWN,ACTION_UP ?

 regards
 Kaushik

 On Fri, Jan 9, 2009 at 6:22 PM, Peli peli0...@googlemail.com wrote:

  what you have to do is, remember the coordinates that you get with the
  ACTION_DOWN event.

  Remember the distance (difference) between those coordinates and the
  original coordinates of your image (call that offsetX and offsetY),
  and subsequently in ACTION_MOVE always add those offset values.

  Peli

  On Jan 9, 11:36 am, kaushik sur kaushik@gmail.com wrote:
   Hi Peli

   here i attach my code, to be added , i have ressolved the issue of double
   image by getting rawX() value of the event , and setting my absolute
  layout
   according to that.
   but here i get a unique problem, whenever i click the button and try to
  drag
   it, the mouse tip comes to a certain pixels above from the topleft corner
  of
   the button,like a offset distance,if you run the code on the emulator u
  wil
   find this problem.
   can anyone help to solve this?

   package com.google.android.samples.view.draganddrop;

   import android.app.Activity;
   import android.content.Context;
   import android.graphics.Canvas;
   import android.os.Bundle;
   import android.view.MotionEvent ;
   import android.view.View;
   import android.view.View.OnClickListener;
   import android.widget.AbsoluteLayout;
   import android.widget.Button;
   import android.widget.Toast;

   public class Drag_And_Drop extends Activity {
    /** Called when the activity is first created. */

   �...@override
    public void onCreate(Bundle icicle) {
     super.onCreate(icicle);

     MyView tx = new MyView(this);
     tx.setText(Drag Me);
     AbsoluteLayout l = new AbsoluteLayout(this);

     AbsoluteLayout.LayoutParams p = new AbsoluteLayout.LayoutParams(
       AbsoluteLayout.LayoutParams.WRAP_CONTENT,
       AbsoluteLayout.LayoutParams.WRAP_CONTENT,10,10);
     l.addView(tx,p);
     setContentView(l);

    }

    class MyView extends Button
    {
     public MyView(Context c){
      super(c);

     }

     @Override
     public boolean dispatchTouchEvent(MotionEvent event) {
      int    mCurX=(int)event.getRawX();
      int mCurY=(int)event.getRawY();;
      System.out.println(scrollx +this.getScrollX());
      int action = event.getAction();
      if ( action == MotionEvent.ACTION_MOVE ) {
       System.out.println(X=+mCurX+  y=+mCurY);
       this.setText(x:  + mCurX + ,y:  + mCurY );
       AbsoluteLayout.LayoutParams p = new
       AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,
         AbsoluteLayout.LayoutParams.WRAP_CONTENT,this.getScrollX()+ mCurX,
         this.getScrollY()+mCurY);
       this.setLayoutParams (p);

      }
      return true;
     }

     @Override
     public void draw(Canvas canvas) {
      // TODO Auto-generated method stub
      super.draw(canvas);

     }

    }

   }

   #main.xml#

   ?xml version=*1.0* encoding=*utf-8*?

   LinearLayout xmlns:android=*http://schemas.android.com/apk/res/android
  
   *

   android:orientation=*vertical
   *

   android:layout_width=*fill_parent
   *

   android:layout_height=*fill_parent
   *

   TextView

   android:layout_width=*fill_parent*

   android:layout_height=*wrap_content*

   android:text=*@string/hello
   *

   /

   Button

   android:id=*@+id/button
   *

   android:layout_width=*fill_parent
   *

   android:layout_height=*wrap_content
   *

   android:text=*start transfer
   *

   /

   /LinearLayout

   regards
   Kaushik

    On Thu, Jan 8, 2009 at 11:23 PM, Dan Raaka micromys...@gmail.com
  wrote:

Refer Launcher code in the source tree.

-M

  

[android-developers] Re: DRAG AND DROP

2009-01-08 Thread kaushik sur
hi

i got a suggestion here. but i really doubt whether it will work or not.
http://groups.google.com/group/android-beginners/browse_thread/thread/fd9f7b241d4c160e/02d2798f5d949b2b

please give me a valid reasoning or example.

regards
Kaushik

On Thu, Jan 8, 2009 at 9:43 PM, kaushik.siso kaushik@gmail.com wrote:


 hi

 i want to know how can i enbale Drag and drop feature in android.
 suppose i have a image,which are to be dragged and dropped on another
 result and it will start a new activity.
 i seek your help to  get a head-start atleast.

 regards
 k...@sis
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-08 Thread Dianne Hackborn
Sorry, there is no support for this currently built into the platform, you
will have to roll it yourself.  You shouldn't have trouble doing it yourself
for drag and drop in the same window (you can look at the standard home
screen for an example), but without system support doing it across windows
is much more challenging.

On Thu, Jan 8, 2009 at 8:13 AM, kaushik.siso kaushik@gmail.com wrote:


 hi

 i want to know how can i enbale Drag and drop feature in android.
 suppose i have a image,which are to be dragged and dropped on another
 result and it will start a new activity.
 i seek your help to  get a head-start atleast.

 regards
 k...@sis
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-08 Thread kaushik sur
hi DIanne

thanks for ur suggestion. but suppose i want to do it on the same
widnow,then what will be the procedure.
trully speaking i am not getting any clue of that. i need prior info to
atleast check this feature on a single window

regards
kaushik

On Thu, Jan 8, 2009 at 11:53 PM, Dianne Hackborn hack...@android.comwrote:

 Sorry, there is no support for this currently built into the platform, you
 will have to roll it yourself.  You shouldn't have trouble doing it yourself
 for drag and drop in the same window (you can look at the standard home
 screen for an example), but without system support doing it across windows
 is much more challenging.

 On Thu, Jan 8, 2009 at 8:13 AM, kaushik.siso kaushik@gmail.comwrote:


 hi

 i want to know how can i enbale Drag and drop feature in android.
 suppose i have a image,which are to be dragged and dropped on another
 result and it will start a new activity.
 i seek your help to  get a head-start atleast.

 regards
 k...@sis




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them.



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-08 Thread Peli

The code sample you linked to should work.

The basic idea is that you continuously put your image to a new
position according to the coordinates that you obtain through
ACTION_MOVE to give the illusion of dragging.
In ACTION_UP you check whether the finger position is close to the
target.
in ACTION_DOWN you can remember the initial finger coordinates so that
you can grab your icon everywhere correctly.

Basically you have to code everything by yourself, but it should not
be very difficult.

Peli
www.openintents.org

On Jan 8, 7:06 pm, kaushik sur kaushik@gmail.com wrote:
 hi

 i got a suggestion here. but i really doubt whether it will work or 
 not.http://groups.google.com/group/android-beginners/browse_thread/thread...

 please give me a valid reasoning or example.

 regards
 Kaushik

 On Thu, Jan 8, 2009 at 9:43 PM, kaushik.siso kaushik@gmail.com wrote:

  hi

  i want to know how can i enbale Drag and drop feature in android.
  suppose i have a image,which are to be dragged and dropped on another
  result and it will start a new activity.
  i seek your help to  get a head-start atleast.

  regards
  k...@sis
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-08 Thread Romain Guy

You can also look at the source code of the Home (Launcher)
application, in particular the class called DragLayer.

On Thu, Jan 8, 2009 at 11:12 AM, Peli peli0...@googlemail.com wrote:

 The code sample you linked to should work.

 The basic idea is that you continuously put your image to a new
 position according to the coordinates that you obtain through
 ACTION_MOVE to give the illusion of dragging.
 In ACTION_UP you check whether the finger position is close to the
 target.
 in ACTION_DOWN you can remember the initial finger coordinates so that
 you can grab your icon everywhere correctly.

 Basically you have to code everything by yourself, but it should not
 be very difficult.

 Peli
 www.openintents.org

 On Jan 8, 7:06 pm, kaushik sur kaushik@gmail.com wrote:
 hi

 i got a suggestion here. but i really doubt whether it will work or 
 not.http://groups.google.com/group/android-beginners/browse_thread/thread...

 please give me a valid reasoning or example.

 regards
 Kaushik

 On Thu, Jan 8, 2009 at 9:43 PM, kaushik.siso kaushik@gmail.com wrote:

  hi

  i want to know how can i enbale Drag and drop feature in android.
  suppose i have a image,which are to be dragged and dropped on another
  result and it will start a new activity.
  i seek your help to  get a head-start atleast.

  regards
  k...@sis
 




-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-08 Thread Peli

which can be found here:
http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=src/com/android/launcher/DragLayer.java
with the related classes being here:
http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=tree;f=src/com/android/launcher

but this is the luxury version, including scaling of the image, scroll
zones, and vibration :-)

Peli

On Jan 8, 8:16 pm, Romain Guy romain...@google.com wrote:
 You can also look at the source code of the Home (Launcher)
 application, in particular the class called DragLayer.



 On Thu, Jan 8, 2009 at 11:12 AM, Peli peli0...@googlemail.com wrote:

  The code sample you linked to should work.

  The basic idea is that you continuously put your image to a new
  position according to the coordinates that you obtain through
  ACTION_MOVE to give the illusion of dragging.
  In ACTION_UP you check whether the finger position is close to the
  target.
  in ACTION_DOWN you can remember the initial finger coordinates so that
  you can grab your icon everywhere correctly.

  Basically you have to code everything by yourself, but it should not
  be very difficult.

  Peli
 www.openintents.org

  On Jan 8, 7:06 pm, kaushik sur kaushik@gmail.com wrote:
  hi

  i got a suggestion here. but i really doubt whether it will work or 
  not.http://groups.google.com/group/android-beginners/browse_thread/thread...

  please give me a valid reasoning or example.

  regards
  Kaushik

  On Thu, Jan 8, 2009 at 9:43 PM, kaushik.siso kaushik@gmail.com wrote:

   hi

   i want to know how can i enbale Drag and drop feature in android.
   suppose i have a image,which are to be dragged and dropped on another
   result and it will start a new activity.
   i seek your help to  get a head-start atleast.

   regards
   k...@sis

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: DRAG AND DROP

2009-01-08 Thread kaushik sur
hi all

i have mentioned about a code link which can be used as an e.g. of the
Drag_N_Drop feature, but there will be small change.
the onMotionEvent(MotionEvent event) has to be replaced by
onTouchEvent(MotionEvent event).
though it starts the Drag_n_drop but it not smooth as u expect.
rather here i am getting a abnormal behavior,i.e, i am getting double image
of the button, that i drag and drop,Can anyone run the code sample and solve
the issue...?

regards
Kaushik

On Fri, Jan 9, 2009 at 2:39 AM, Peli peli0...@googlemail.com wrote:


 which can be found here:

 http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=src/com/android/launcher/DragLayer.java
 with the related classes being here:

 http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=tree;f=src/com/android/launcher

 but this is the luxury version, including scaling of the image, scroll
 zones, and vibration :-)

 Peli

 On Jan 8, 8:16 pm, Romain Guy romain...@google.com wrote:
  You can also look at the source code of the Home (Launcher)
  application, in particular the class called DragLayer.
 
 
 
   On Thu, Jan 8, 2009 at 11:12 AM, Peli peli0...@googlemail.com wrote:
 
   The code sample you linked to should work.
 
   The basic idea is that you continuously put your image to a new
   position according to the coordinates that you obtain through
   ACTION_MOVE to give the illusion of dragging.
   In ACTION_UP you check whether the finger position is close to the
   target.
   in ACTION_DOWN you can remember the initial finger coordinates so that
   you can grab your icon everywhere correctly.
 
   Basically you have to code everything by yourself, but it should not
   be very difficult.
 
   Peli
  www.openintents.org
 
   On Jan 8, 7:06 pm, kaushik sur kaushik@gmail.com wrote:
   hi
 
   i got a suggestion here. but i really doubt whether it will work or
 not.http://groups.google.com/group/android-beginners/browse_thread/thread.
 ..
 
   please give me a valid reasoning or example.
 
   regards
   Kaushik
 
   On Thu, Jan 8, 2009 at 9:43 PM, kaushik.siso kaushik@gmail.com
 wrote:
 
hi
 
i want to know how can i enbale Drag and drop feature in android.
suppose i have a image,which are to be dragged and dropped on
 another
result and it will start a new activity.
i seek your help to  get a head-start atleast.
 
regards
k...@sis
 
  --
  Romain Guy
  Android framework engineer
  romain...@android.com
  
  Note: please don't send private questions to me, as I don't have time
  to provide private support.  All such questions should be posted on
  public forums, where I and others can see and answer them
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---