Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:25:02+00:00 2026-05-25T15:25:02+00:00

getting this error in logcat 09-15 14:38:09.944: ERROR/AndroidRuntime(1065): FATAL EXCEPTION: AsyncTask #1 09-15 14:38:09.944:

  • 0

getting this error in logcat

09-15 14:38:09.944: ERROR/AndroidRuntime(1065): FATAL EXCEPTION: AsyncTask #1
09-15 14:38:09.944: ERROR/AndroidRuntime(1065): java.lang.RuntimeException: An error occured while executing doInBackground()
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.lang.Thread.run(Thread.java:1096)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at android.os.Handler.<init>(Handler.java:121)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at android.app.Dialog.<init>(Dialog.java:101)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at android.app.AlertDialog.<init>(AlertDialog.java:63)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at android.app.AlertDialog.<init>(AlertDialog.java:59)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at android.app.AlertDialog$Builder.create(AlertDialog.java:786)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at com.UserLogin.UserLogin$CheckUser.doInBackground(UserLogin.java:198)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at com.UserLogin.UserLogin$CheckUser.doInBackground(UserLogin.java:1)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-15 14:38:09.944: ERROR/AndroidRuntime(1065):     ... 4 more

AsyncTask Code

private class CheckUser extends AsyncTask<String, Void, Void> {
        private AlertDialog AD1;

        @Override
        protected Void doInBackground(String... params) {
            // TODO Auto-generated method stub
            HttpClient httpclient = new DefaultHttpClient();
            // Dh.getWritableDatabase();

            HttpPost httppost = new HttpPost(url);
            List<NameValuePair> params1 = new ArrayList<NameValuePair>(2);
            params1.add(new BasicNameValuePair("username", Username));

            try {
                httppost.setEntity(new UrlEncodedFormEntity(params1));
                Log.i("Params",EntityUtils.toString(new UrlEncodedFormEntity(params1)));
                HttpResponse responseGet = httpclient.execute(httppost);
                HttpEntity entity = responseGet.getEntity();
                if (entity != null) {

                    InputStream inputStreamResponse = entity.getContent();
                    result = convertStreamToString(inputStreamResponse);
                    System.out.println(result);
                    db = InsertData.getWritableDatabase();
                    ContentValues values = new ContentValues();

                    MyUserJsonObject = new JSONObject(result);

                    JSONObject menuObject = MyUserJsonObject.getJSONObject("UserDetails");
                    attributeId = menuObject.getString("login");

                    System.out.println(attributeId);
                    if (attributeId.equals("success")) {
                        JSONObject FriendObject = menuObject.getJSONObject("friendslist");
                        JSONArray FriendArray = FriendObject.getJSONArray("friends");

                        for (int i = 0; i < FriendArray.length(); i++) {

                            values.put(DatabaseHelper.FriendName, FriendArray.getJSONObject(i).getString("FriendName").toString());
                            values.put(DatabaseHelper.FriendMobile, FriendArray.getJSONObject(i).getString("Mobile").toString());
                            db.insert(DatabaseHelper.FRIENDTABLE, null, values);

                        }
                        values.clear();

                        JSONObject PlaceObjet = menuObject.getJSONObject("findplaces");
                        JSONArray PlacesArray = PlaceObjet.getJSONArray("places");
                        for (int i = 0; i < PlacesArray.length(); i++) {
                            values.put(DatabaseHelper.Name, PlacesArray.getJSONObject(i).getString("Name").toString());
                            values.put(DatabaseHelper.Image,PlacesArray.getJSONObject(i).getString("Image").toString());
                            db.insert(DatabaseHelper.LOCATIONTABLE, null,values);
                        }
                        values.clear();
                        db.close();
                        // System.out.println(friendslist);

                    } else {
                        dialog1.dismiss();

                    }
                }
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            catch (IOException e) {
                // TODO Auto-generated catch block
                // e.printStackTrace();
                AlertDialog ADl = new AlertDialog.Builder(
                        getApplicationContext()).create();
                ADl.setTitle("Login Failed..");
                ADl.setMessage("You have Entered Wrong Username/Password Please try again");
                ADl.setIcon(R.drawable.oops);
                ADl.setButton("Ok", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        dialog.cancel();
                    }
                });
                ADl.show();
            }

            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            // TODO Auto-generated method stub
            dialog1.dismiss();
            if(attributeId.equals("success")){
            Intent innerintent = new Intent(getApplicationContext(),Innerpage.class);
            startActivity(innerintent);
            } else {
                 dialog1.dismiss();
                TextView Tv=(TextView)findViewById(R.id.error);
                 Tv.setText("Please Enter Valid Username/password");
             }
            if(attributeId.equals("success")){ 
                    Intent innerintent = new Intent(getApplicationContext(),Innerpage.class);
                    startActivity(innerintent);
                } else {
                    AD1= new AlertDialog.Builder(getApplicationContext()).create();
                    ADl.setTitle("Login Failed.."); ADl.setMessage("You have Entered Wrong Username/Password Please try again");
                    ADl.setIcon(R.drawable.oops); ADl.setButton("Ok", new
                            DialogInterface.OnClickListener() {

                        @Override public void onClick(DialogInterface dialog, int which)
                        { //TODO Auto-generated method stub 
                            dialog.cancel(); 
                        } 
                    });
                }
                ADl.show(); 
            }       
        }

        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub
            dialog1 = ProgressDialog.show(UserLogin.this, "","Please wait for few seconds...", true);
            dialog1.show();
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:25:02+00:00Added an answer on May 25, 2026 at 3:25 pm

    You are trying to build an AlertDialog inside the doInBackground method of your asynctask.

    You can’t do that unless you first prepare a looper or something (which is complex).

    Instead, create your AlertDialog either in the onProgressUpdate or onPostExecute method, or in a Runnable that runs on the UI thread (via runOnUIThread, for example)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im getting an error from logcat: 01-13 17:53:25.368: E/AndroidRuntime(3235): Caused by: java.lang.NullPointerException 01-13 17:53:25.368:
Im not gettin the following error fixed (logcat): E/AndroidRuntime( 1010): FATAL EXCEPTION: Thread-105 E/AndroidRuntime(
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
I can't figure out why I'm getting this error in logcat: 02-14 15:44:42.470: E/ActivityThread(32164):
I am getting this error from the logcat org.apache.http.NoHttpResponseException: The target server failed to
I am getting this exception in database Leak Found my LOGCAT Shows this: 02-17
I am getting this error while trying to Parse the Xml response from the
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Anyone getting this error when using the new free chart controls MS bought from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.