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.

Recommended Answers

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

Jump to Post

You are performing network activity on UI thread!!! Ggrrrrrrrrrr!!!! This is big NO! Read this http://developer.android.com/training/basics/network-ops/connecting.html

Jump to Post

All 6 Replies

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

public void onClick(View arg0){


       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("");

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

   catch(IOException ex){

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


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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.