0% found this document useful (0 votes)
18 views

New Text Document

he

Uploaded by

Mexson Fernandes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

New Text Document

he

Uploaded by

Mexson Fernandes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

public void onClick(View view) {

String des = description.getText().toString();

//check whether the des empty or not


if(des.length()>0 || category.getSelectedItem().toString() !=
"-----Blank-----") {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.google.com/");

try {
List<NameValuePair> nameValuePairs = new
ArrayList<NameValuePair>(2);
//nameValuePairs.add(new BasicNameValuePair("id", "01"));
nameValuePairs.add(new BasicNameValuePair("description",
des));
nameValuePairs.add(new BasicNameValuePair("category",
category.getSelectedItem().toString()));
nameValuePairs.add(new BasicNameValuePair("media",
attachment.toString()));
httppost.setEntity(new
UrlEncodedFormEntity(nameValuePairs));
httpclient.execute(httppost);
//description.setText(""); //reset the message text field
Toast.makeText(getBaseContext(),"Sent message to
server",Toast.LENGTH_SHORT).show();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
//display message if text field is empty
Toast.makeText(getBaseContext(),"All fields are
required",Toast.LENGTH_SHORT).show();
}
}

You might also like