système d'exploitation android de réseau sur le thread principal exception

- je faire de ce code unique de la demande de travail, mais si vous joindre à d'autres applications , afficher cette boîte de dialogue "système d'exploitation android de réseau sur le thread principal exception"

 package com.kelompok2.bissmilahpulsa;
import java.util.ArrayList;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
public class coba extends Activity {
EditText nm,nmr;
RadioGroup prov,nom,pem;
TextView error;
Button ok;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mulaitransaksi);
nm=(EditText)findViewById(R.id.et_nama);
nmr=(EditText)findViewById(R.id.et_nomor);
prov=(RadioGroup)findViewById(R.id.provider);
nom=(RadioGroup)findViewById(R.id.nominal);
error=(TextView)findViewById(R.id.error);
pem=(RadioGroup)findViewById(R.id.pembayaran);
ok=(Button)findViewById(R.id.btn_ok);
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//TODO Auto-generated method stub
String type=null;
String type1=null;
String type2=null;
switch (prov.getCheckedRadioButtonId()) 
{
case R.id.rb_as:
type="As";
break;
case R.id.rb_axis:
type="Axis";
break;
case R.id.rb_im3:
type="Im3";
break;
case R.id.rb_telkomsel:
type="Telokmsel";
break;
case R.id.rb_xl:
type="Xl";
break;
}
switch (nom.getCheckedRadioButtonId()) 
{
case R.id.rb_5:
type1="5";
break;
case R.id.rb_10:
type1="10";
break;
case R.id.rb_20:
type1="20";
break;
case R.id.rb_50:
type1="50";
break;
}
switch (pem.getCheckedRadioButtonId()) 
{
case R.id.rb_cash:
type2="Cash";
break;
case R.id.rb_hutang:
type2="Hutang";
break;
}
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("nama", nm.getText().toString()));
postParameters.add(new BasicNameValuePair("nomor", nmr.getText().toString()));
postParameters.add(new BasicNameValuePair("provider", type));
postParameters.add(new BasicNameValuePair("nominal", type1));
postParameters.add(new BasicNameValuePair("jenis_pembayaran", type2));
String response = null;
try {
response = CustomHttpClient.executeHttpPost("http://appmob.pusku.com/save.php", postParameters);
String res = response.toString();
res = res.trim();
res = res.replaceAll("\\s+","");
error.setText(res);
if (res.equals("1")) error.setText("Data Tersimpan");
else error.setText("Data Tersimpan Ke server");
}
catch (Exception e) {
error.setText(e.toString());
}
String nama1 = nm.getText().toString();
String nama2 = nmr.getText().toString();
String nama3 = type;
String nama4 = type1;
String nama5 = type2;
String sms = nama1+"#"+nama2+"#"+nama3+"#"+nama4+"#"+nama5;
Intent    i = new Intent (Intent.ACTION_SENDTO,Uri.parse("sms:5556"));
i.putExtra("sms_body", sms);
startActivity(i); 
nm.setText(null);
nmr.setText(null);  
}
});
}   
}

en permission, je actif que <uses-permission android:name="android.permission.INTERNET"/>
et toujours pas de travail

OriginalL'auteur Alit Perdana | 2013-06-28