views:

286

answers:

4

Is there a way to access the copy/paste api/UI in an Android / HTC Sense based phone?

I really like the way a long press works in a large canvas while using Sense. Is there a way to programmatically detect code is running on a Sense-based phone and call out to those APIs?

A: 

that is a good questions - I would like my app to appear on the sendto menu

Does anyone know how?

/Paul

PaulF
-1. Did you seriously "answer" by posting an unrelated question?
EboMike
Sorry didn't want to offen anyone. I am new to this site and came here looking for help. Please tell me what I did wrong.
PaulF
If you want to ask a question, just click the "ask question" at the top. Don't ask questions in response to other questions. A +1 "me too" isn't an answer either, so keep those to comments. Key thing is, a "comment" is not the same as "your answer".
Cylindric
@PaulF - you'll be able to comment on other's questions after you build up a reputation of 50 or greater. Until then, you can only comment on your own answers. Check the FAQ out for more information
Benjamin Anderson
+1  A: 

Ok, I have to be honest here, I haven't played with android yet, although I'm planning to do that soon. However I have been working on the Microsoft Surface table.

If the standard android library does not implement functionality to detect some sort of touch and hold event I suggest the following:

I think you could easily implement such helper yourself. What you will probably want to do is add a listener to the touch event of that canvas. At the moment a finger touches the canvas, you start running a timer. When the timer ends, you fire your desired event. However, this will also need you to implement a few other things. When the finger moves outside a certain threshold, or the finger is lifted again, the timer needs to be stopped and cleaned up so it won't fire anymore.

In this scenario you have created the touch and hold scenario for yourself. All you have to pay attention to is that you break it off on added touch-manipulation.

(I really reckon the standard touch library must contain something similar to this functionality though!)


From what I was able to find with a few searches was:

@Override
public void onLongPress(MotionEvent e)
{
    //Call your own custom copy paste dialog here.
}

(Otherwise you might find something to your liking in the GestureDetector?)

The copypaste functionality uses the ClipboardManager. All you need is to create a popup menu containing copy and paste images with the associated text and a hooks to that ClipboardManager.

Waltes
A: 

I'm new to Android development as well, but I think what you are looking for is the R.id class. Here's the API documentation link:

http://developer.android.com/reference/android/R.id.html

This looks like how it's used:

menu.add(0, android.R.id.copy, menuIndex++, android.R.string.copy);

menu.add(0, android.R.id.paste, menuIndex++, android.R.string.paste);

Good luck with your app!

Sam

Samuel Leathers
+1  A: 

No, very certainly not. There is only one copy/paste API in Android, though implementation details may differ between skins, if you can call it an API even because it comes for free if you choose the right UI elements.

I also do not know what you mean by "the way a long press works in a large canvas while using Sense". When I compare copying text and selecting text in stock Android and HTC Sense it mostly is the same (except for colors etc.). Could you make your question more specific?

Edit: Maybe you meant this: http://stackoverflow.com/questions/3647022/add-my-app-to-htc-cut-paste-sendto-menu

pjv
No, I think he meant how to move the icons and widgets
rds