0

Ok so I'm new to android programming and have taken on a project way outside my wheelhouse. I found an opensourced project that does "kinda" what I want it to do its remote droid 2.0 but I don't need the mouse aspect of it. I just need to place a button that sends the keystroke of 'w' but I cant find anything on the web to tell me how. I know how I would do this in PHP and javascript, I would just add an onclick event but no idea in android.

So in closing please help a newby out examples or any tutorials that would get me to the end effect i need

Its funny how I've made fun of people in the past for saying "i just wanna ____ why is that so hard" and i always say code doesn't understand what you want until you tell it. now im faced with swallowing my own sarcasm.

dennis
  • 85
  • 1
  • 1
  • 6
  • To catch the click of the button you just set an onClickListener to it and code what it does in the onClick function of the listener. Sending that to a server is a lot more complicated, do some web searches on doing http requests in android. – Gabe Sechan Apr 17 '13 at 06:42
  • send an integer value for each click event that u receive – Viswanath Lekshmanan Apr 17 '13 at 06:44

1 Answers1

1

Do you intend to send keystrokes from your own app, or do you want to do a 'keylogger' and send to the server keys pressed on the phone?

For the former, you might want to look at: -https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae

the example to do something when a button is clicked.

Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() { 
public void onClick(View v) {
    postData(); //refer to the comments for the postData() example.
});
Angel Koh
  • 12,479
  • 7
  • 64
  • 91
  • I just want to send the keystoke of w to the server (which is already set up to receive the http event from the soft keyboard with the code – dennis Apr 17 '13 at 06:59
  • 1
    @dennis, so you just want to do a http GET or POST when you click a button ? the POST example is here http://stackoverflow.com/questions/2938502/sending-post-data-in-android – Angel Koh Apr 17 '13 at 07:10