Hi i need your help please I am still learning android...i don't know this error "at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1133)"...
can you help me how to solve this.

Thank you.

You'll probably need to post your code for anyone to help you here.

public void onClick(View arg0){


   try{


       HttpClient httpclient = new DefaultHttpClient();
       nameValuePairs = new ArrayList<NameValuePair>(2);
       nameValuePairs.add(new BasicNameValuePair("username",username.getText().toString()));
       nameValuePairs.add(new BasicNameValuePair("password",password.getText().toString()));

       HttpPost  httppost = new HttpPost("http://10.0.2.2:8080/myandroid/add.php");


       httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
       HttpResponse response = httpclient.execute(httppost);


   }
   catch(IOException ex){
       System.out.print(ex.getMessage());
   }

    Toast  toast = Toast.makeText(this, username.getText()+" "+password.getText(), Toast.LENGTH_SHORT);
    toast.show();

}

Hi peter budo,Thank you for the reply...can i ask how did you know that i am performing in the UI thread...I do apologize i am still learning android.

Thank you so much Peter Budo it's working now

To respond to your previous question answer is simple. onClick() event have to be associated with listener that has to be attached to UI element that can only exist in View, Fragment or Activity

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.