how to depress the onLongClick() when drag a view

by sheng wang » Mon, 19 Apr 2010 14:47:24 GMT


Sponsored Links
 Hi,

I have a View and I can drag it. It also has a onLongClick() method so it
can respond to the long press on the screen.

The problem is when I drag it , the onLongClick will also be triggered .
Anyone have an idea to depress the long click detection when i move it .


Thanks in advances.
Shawn.

--



how to depress the onLongClick() when drag a view

by grace » Mon, 19 Apr 2010 16:28:42 GMT


 hi,

try disabling the longclick event using public void setLongClickable
(boolean longClickable)
function  while ur performing the drag operation and enable it after
that..
so that u can have both the functionalities..

regards,
Grace.



>


Sponsored Links


how to depress the onLongClick() when drag a view

by grace » Mon, 19 Apr 2010 16:30:44 GMT


 hi,

try disabling the longClick event using  public void setLongClickable
(boolean longClickable)
function while ur performing the drag operation and enable it after
that..
so that u can have both the functionalities..


Regards,
Grace.



>



Other Threads

1. TextView @id/android:empty - What am i doing wrong?

Hi all,

I'd like to create a ListView that, when empty, displays text indicating
that it's empty.  I've looked around the web, and found some articles, but
nothing seems to be working - Even a direct copy and paste from these
examples (one from developer.android.com) does not have the desired effect.

I've had just about every result happen to me except the intended effect.
 I've had the TextView show up instead of the ListView, even when ListView
is not empty.  I've had the TextView NOT show up when the ListView is empty.
 And now, i have both the populated ListView and the android:empty TextView
showing on the screen at the same time.

Here is my layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/MainPageLayout"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical" >

    <TextView android:id="@+id/text_main_instructions"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceSmall"
  android:gravity="center_vertical"
  android:paddingLeft="6dip"
  android:paddingRight="6dip"
      android:text="@string/main_instructions"
      android:layout_alignParentTop="true"/>

    <ListView android:id="@+id/android:list"
              android:layout_width="fill_parent"
  android:layout_height="fill_parent"
      android:textAppearance="?android:attr/textAppearanceMedium"
  android:gravity="center_vertical"
  android:layout_weight="1"
  android:paddingLeft="6dip"
  android:paddingRight="6dip"
              android:layout_below="@id/text_main_instructions"
              android:drawSelectorOnTop="false"/>

  <TextView android:id="@id/android:empty"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:textAppearance="?android:attr/textAppearanceMedium"
  android:gravity="center_vertical|center_horizontal"
  android:paddingLeft="6dip"
  android:paddingRight="6dip"
           android:text="@string/main_schedule_empty"
  android:layout_below="@id/text_main_instructions"/>
</LinearLayout>

Is there something i have to call in code to make this work?  What am i
doing wrong?

Also, does my ListView have to have the id "@id/android:list" in order for
this to work, or can i give it a different id?

-- 
//Nick Richardson
//richardson.n...@gmail.com

-- 

2. How to use my contact list

Hi,
i want application to send an sms to one of my contacts.the problem
consists is getting the phone number,not the name.
using this code
public void onActivityResult(int reqCode, int resultCode, Intent data)
{
          super.onActivityResult(reqCode, resultCode, data);
          switch (reqCode) {
            case (PICK_CONTACT) :
              if (resultCode == Activity.RESULT_OK) {
                Uri contactData = data.getData();
                Cursor c =  managedQuery(contactData, null, null, null,
null);
                if (c.moveToFirst()) {
                   String number =
c.getString(c.getColumnIndexOrThrow(People.NUMBER));
                   String name=
c.getString(c.getColumnIndexOrThrow(People.NAME));
                   txtPhoneNo.setText(number+""+name);
                                }
              }
it returns "null" for number with the correct name,so i've tried to
get the number as "int" and use a cast later but get strange thing:
always number "6" instead of the phone number and always with the
correct name.
how can i fix it?
Thank you for help

-- 

3. Repost WTS: Motorola Droid 2nd + Bonus

4. Unable to release partial wake lock in service

5. How do I set the selected state of an item in a gallery (the correct way)

6. Is it possible for my Activity to be notified when the external storage state changes?

7. Andriod Email Flaw