Hey so I am pretty new to this android dev world and am trying to figure out a few things...
First off the end goal is to be able to create a form on android and to click on a submit button that should essentially send over the data just like a form on a website with AJAX doing the POST and GET response.
I have created the form and the button in the layout and have called in the java file a onClickListener that has the input text from the user, but I do not know how to send the data as a json to my node.js servers.
Here is my code:
//button for posting details
Button postWardrobe = (Button) findViewById(R.id.postButton);
final EditText nameField = (EditText) findViewById(R.id.nameFieldWardrobeScreen);
postWardrobe.setOnClickListener(new OnClickListener() {
private Editable Data;
@Override
public void onClick(View v) {
//below should send data over
Data = nameField.getText();
}
});
I added only the code that is currently being worked with as the submit form... now I read some thing about http Connection but I am not sure how to implement it exactly or how to send it over to the server as it does not seem to link to it in any way... I want it to post to my localhost and also in the future to the server...
Also, I am not sure if I should be using sockets instead or just http... any advice and answer to sending the data over would be great, thanks.