Go Back   Android Forums > Android Discussion > Android Games > Post Your Codes

test: Reply
LinkBack Thread Tools
Old March 16th, 2011, 06:06 AM   #1 (permalink)
New Member
Thread Author (OP)
Join Date: Mar 2011
Posts: 2
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in connection from android to mysql(wamp)

public class motor extends Activity {
public static final int REQUEST_CODE=1;
/** Called when the activity is first created. */
Button b;
RadioButton r1;
EditText tv;
String text;
public void onCreate(Bundle savedInstanceState) {
b.setOnClickListener(new clickhandler());
public class clickhandler implements OnClickListener
public void onClick(View v)
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://localhost/getAllPeopleBornAfter.php");

try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
//ameValuePairs.add(new BasicNameValuePair("mydata", "Mek Mek"));
// httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
InputStream is = response.getEntity().getContent();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayBuffer baf = new ByteArrayBuffer(20);
int current = 0;
while((current = bis.read()) != -1){
text = new String(baf.toByteArray());
} catch (ClientProtocolException e) { tv.setText(e.toString());
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block

//Intent intent=new Intent(motor.this,motor1.class);



nagaraja is offline  
Reply With Quote
sponsored links

Go Back   Android Forums > Android Discussion > Android Games > Post Your Codes
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -5. The time now is 08:23 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.