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

  • Home
  • SEARCH
  • 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 8953299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:03:59+00:00 2026-06-15T14:03:59+00:00

I want to get data from MySQL database using PHP and display it in

  • 0

I want to get data from MySQL database using PHP and display it in Android activity. I code it and pass JSON Array but there is a problem i dont know how to connect to server and my all database is on local server. I code it Kindly tell me where i go wrong so I can get exact results. I’ll be very thankful to you.

my all database is in localhost and it is not opening an activity. displays an error “Stopped unexpectedly”:( How can i get exact results. Kindly guide me

now it gives these errors:( and and loading saved details

    12-08 11:09:19.314: E/WindowManager(19972): Activity com.example.visit.record.My_Task has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40555850 that was originally added here
12-08 11:09:19.314: E/WindowManager(19972): android.view.WindowLeaked: Activity com.example.visit.record.My_Task has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40555850 that was originally added here
12-08 11:09:19.314: E/WindowManager(19972):     at android.view.ViewRoot.<init>(ViewRoot.java:277)
12-08 11:09:19.314: E/WindowManager(19972):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
12-08 11:09:19.314: E/WindowManager(19972):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
12-08 11:09:19.314: E/WindowManager(19972):     at android.view.Window$LocalWindowManager.addView(Window.java:433)
12-08 11:09:19.314: E/WindowManager(19972):     at android.app.Dialog.show(Dialog.java:288)
12-08 11:09:19.314: E/WindowManager(19972):     at com.example.visit.record.My_Task$GetTaskDetails.onPreExecute(My_Task.java:149)
12-08 11:09:19.314: E/WindowManager(19972):     at android.os.AsyncTask.execute(AsyncTask.java:391)
12-08 11:09:19.314: E/WindowManager(19972):     at com.example.visit.record.My_Task.onCreate(My_Task.java:107)
12-08 11:09:19.314: E/WindowManager(19972):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
12-08 11:09:19.314: E/WindowManager(19972):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
12-08 11:09:19.314: E/WindowManager(19972):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842)
12-08 11:09:19.314: E/WindowManager(19972):     at android.app.ActivityThread.access$1500(ActivityThread.java:132)
12-08 11:09:19.314: E/WindowManager(19972):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
12-08 11:09:19.314: E/WindowManager(19972):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-08 11:09:19.314: E/WindowManager(19972):     at android.os.Looper.loop(Looper.java:143)
12-08 11:09:19.314: E/WindowManager(19972):     at android.app.ActivityThread.main(ActivityThread.java:4268)
12-08 11:09:19.314: E/WindowManager(19972):     at java.lang.reflect.Method.invokeNative(Native Method)
12-08 11:09:19.314: E/WindowManager(19972):     at java.lang.reflect.Method.invoke(Method.java:507)
12-08 11:09:19.314: E/WindowManager(19972):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-08 11:09:19.314: E/WindowManager(19972):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-08 11:09:19.314: E/WindowManager(19972):     at dalvik.system.NativeStart.main(Native Method)
  • 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-06-15T14:04:07+00:00Added an answer on June 15, 2026 at 2:04 pm

    Currently you are Trying to access Ui elements or runOnUiThread inside doInBackground in GetProductDetails AsyncTask class . because it’s not possible to access UI elements from doInBackground you can use onPreExecute and onPostExecute for updating UI elements.Change your code as without using runOnUiThread or UI elements inside doInBackground :

          class GetProductDetails extends AsyncTask<String, String, JSONObject> {
    
            /**
             * Before starting background thread Show Progress Dialog
             * */
    
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                tDialog = new ProgressDialog(My_Task.this);
                tDialog.setMessage("Loading task details. Please wait...");
                tDialog.setIndeterminate(false);
                tDialog.setCancelable(true);
                tDialog.show();
            }
       protected JSONObject doInBackground(String... params) {
    
                       JSONObject my_task 
                        // Check for success tag
                        int success;
                        try {
                            // Building Parameters
                            List<NameValuePair> params = new ArrayList<NameValuePair>();
                            params.add(new BasicNameValuePair("cid", cid));
    
                            // getting product details by making HTTP request
                            // Note that product details url will use GET request
                            JSONObject json = JSONParser.makeHttpRequest(
                                    url_read_mytask, "GET", params);
    
                            // check your log for json response
                            Log.d("Single Task Details", json.toString());
    
                            // json success tag
                            success = json.getInt(TAG_SUCCESS);
                            if (success == 1) {
                                // successfully received product details
                                JSONArray my_taskObj = json
                                        .getJSONArray(TAG_MYTASK); // JSON Array
    
                                // get first product object from JSON Array
                                my_task = my_taskObj.getJSONObject(0);
    
    
                            }
                            else
                            {
                                // task with cid not found
                            }
                        } 
                        catch (JSONException e) {
                            e.printStackTrace();
                        }
    
    
                return my_task;
            }
            protected void onPostExecute(JSONObject my_task) {
                // dismiss the dialog once got all details
    
                // task with this cid found
                // Edit Text
                 // display task data in EditText
    
                 cus_name_txtbx = (EditText) findViewById(R.id.cus_name_txt);
                 cus_name_txtbx.setText(my_task.getString(TAG_NAME));
    
                 contact_no_txtbx = (EditText) findViewById(R.id.contact_no_txt);
                 contact_no_txtbx.setText(my_task.getString(TAG_CONTACT));
    
                 ticket_no_txtbx = (EditText) findViewById(R.id.ticket_no_txt);
                 ticket_no_txtbx.setText(my_task.getString(TAG_TICKET));
    
                 task_detail_txtbx = (EditText) findViewById(R.id.task_detail_txt);
                 task_detail_txtbx.setText(my_task.getString(TAG_TASKDETAIL));
                tDialog.dismiss();
            }
    

    and Change your onCreate code as:

    public class My_Task extends Activity {
    
            TextView cus_name_txt, contact_no_txt, ticket_no_txt, task_detail_txt,attend_by_txts;
            EditText attend_by_txtbx, cus_name_txtbx, contact_no_txtbx, ticket_no_txtbx, task_detail_txtbx;
            Button btnSave;
            Button btnDelete;
    
    ////YOUR CODE here
    
      @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.my_task);
    
    
            cus_name_txt = (TextView) findViewById(R.id.cus_name_txt);
    
            contact_no_txt = (TextView)findViewById(R.id.contact_no_txt);
    
            ticket_no_txt = (TextView)findViewById(R.id.ticket_no_txt);
    
            task_detail_txt = (TextView)findViewById(R.id.task_detail_txt);
    
            attend_by_txts = (TextView)findViewById(R.id.attend_by_txt;
    
            attend_by_txtbx = (EditText)findViewById(R.id.attend_by_txtbx);
            attend_by_txtbx.setText(attend_by_txt);
            //your code here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can get data from MySql with use of php using android successfully. But
I am using php with httpost to get data from an external mysql database.
I want to get data from mysql database with the help of DataImportHandler so
I want to get data from a table in my MySQL database. $linkID =
I want to get data from the database (MySQL) by JPA, I want it
I want to get data from table in MySQL and to show it in
Here's the scenario, I want to get Data from the Service to Activity Whenever
I am using http://lite.facebook.com And i want to get some data from my account.
Simply said: How do I receive data from a PHP echo to display using
I'm pulling a table from a MySQL database, using PHP. This is roughly the

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.