Android 4.2.2 ile postetme sorunu
Merhaba arkadaşlar,android 4.2.2 ile web ortamına veri göndermeye çalışıyorum fakat program hata veriyor ve kapanıyor
uygulamada veri göndermeye çalıştığım bölüm şu şekilde
package com.arslansahin.webrehber;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class HttpSend extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.httpsend);
}
public void onClick_postData(View v) throws ClientProtocolException{
TextView numaraListesi = (TextView) findViewById(R.id.numaraListesi);
Bundle veriTasi = getIntent().getExtras();
String posst = veriTasi.getString("tasinanVeriler");
numaraListesi.setText(posst);
HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://populasyon.com/apk/wr.php");
try {
List<NameValuePair> namevp = new ArrayList<NameValuePair>();
namevp.add(new BasicNameValuePair("datalar","test verisi"));
httppost.setEntity(new UrlEncodedFormEntity(namevp));
HttpResponse response = client.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}
}