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 8620175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:31:13+00:00 2026-06-12T06:31:13+00:00

I have code like this to show data from mysql, its to read data

  • 0

I have code like this to show data from mysql,

its to read data

protected String doInBackground(String... params) {
            // updating UI from Background Thread
            runOnUiThread(new Runnable() {
                public void run() {
                       // Building Parameters
                //  int success;
                    try {
                        // Building Parameters
                        List<NameValuePair> params = new ArrayList<NameValuePair>();
                        params.add(new BasicNameValuePair("phone", mPhoneNumber));
                        params.add(new BasicNameValuePair("id_store", id_store));

                        // getting store details by making HTTP request
                        // Note that store details url will use GET request
                        JSONObject json = jsonParser.makeHttpRequest(Constants.url_store_detail, "GET", params);

                        // check your log for json response
                        Log.d("Single Store Details", json.toString());

                        // json success tag

                            // successfully received store details
                            JSONArray storeObj = json.getJSONArray("store"); // JSON Array

                            // get first product object from JSON Array
                            JSONObject store = storeObj.getJSONObject(0);

                            // product with this pid found
                            // Edit Text
                            urledit = (EditText) findViewById(R.id.ETurledit);
                            storenameedit = (EditText) findViewById(R.id.ETusernameedit);
                            storedescedit = (EditText) findViewById(R.id.ETdescedit);
                            edittype=(Spinner)findViewById(R.id.Stypeedit);

                            String url = json.getString(TAG_URL);

                            // display store data in EditText
                            urledit.setText(store.getString(TAG_URL));
                            storenameedit.setText(store.getString(TAG_NAME));
                            storedescedit.setText(store.getString(TAG_DESC));               

                            if(store.getString(TAG_TYPE).equals("1")){
                                String mine = store.getString("Wordpress");
                                ArrayAdapter myadap = (ArrayAdapter)edittype.getAdapter();

                                int spinnerpos = myadap.getPosition(mine);
                                edittype.setSelection(spinnerpos);

                            }else{
                                String mine = store.getString("Prestashop");
                                ArrayAdapter myadap = (ArrayAdapter)edittype.getAdapter();

                                int spinnerpos = myadap.getPosition(mine);

                                edittype.setSelection(spinnerpos);


                            }

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            });

            return null;
        }

but it show error like this

10-04 13:08:57.377: DEBUG/dalvikvm(306): GC_EXPLICIT freed 42 objects / 2008 bytes in 260ms
10-04 13:08:59.837: INFO/ActivityManager(59): Starting activity: Intent { cmp=shoop3.android.edu/.editstoreActivity (has extras) }
10-04 13:09:01.148: DEBUG/dalvikvm(1272): GC_FOR_MALLOC freed 1456 objects / 269496 bytes in 198ms
10-04 13:09:01.407: DEBUG/Single Store Details(1272): {"store":{"id_user":"56","id_platform":"2","store_url":"prestashop","store_desc":"dasdasd","id_store":"38","store_logo":null,"store_name":"prestashop","store_curr":null}}
10-04 13:09:01.427: WARN/System.err(1272): org.json.JSONException: Value {"id_user":"56","id_platform":"2","store_url":"prestashop","store_desc":"dasdasd","id_store":"38","store_logo":null,"store_name":"prestashop","store_curr":null} at store of type org.json.JSONObject cannot be converted to JSONArray
10-04 13:09:01.457: WARN/System.err(1272):     at org.json.JSON.typeMismatch(JSON.java:96)
10-04 13:09:01.457: WARN/System.err(1272):     at org.json.JSONObject.getJSONArray(JSONObject.java:548)
10-04 13:09:01.507: WARN/System.err(1272):     at shoop3.android.edu.editstoreActivity$GetStoreDetails$1.run(editstoreActivity.java:189)
10-04 13:09:01.507: WARN/System.err(1272):     at android.os.Handler.handleCallback(Handler.java:587)
10-04 13:09:01.517: WARN/System.err(1272):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-04 13:09:01.517: WARN/System.err(1272):     at android.os.Looper.loop(Looper.java:123)
10-04 13:09:01.517: WARN/System.err(1272):     at android.app.ActivityThread.main(ActivityThread.java:4627)
10-04 13:09:01.528: WARN/System.err(1272):     at java.lang.reflect.Method.invokeNative(Native Method)
10-04 13:09:01.528: WARN/System.err(1272):     at java.lang.reflect.Method.invoke(Method.java:521)
10-04 13:09:01.528: WARN/System.err(1272):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-04 13:09:01.537: WARN/System.err(1272):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-04 13:09:01.577: WARN/System.err(1272):     at dalvik.system.NativeStart.main(Native Method)
10-04 13:09:02.948: INFO/ActivityManager(59): Displayed activity shoop3.android.edu/.editstoreActivity: 3002 ms (total 3002 ms)

How to solve this?? bcause it show error that JSONObject cannot converter to JSONArray ,
i hope someone can help me , thanks for ur advice

  • 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-12T06:31:14+00:00Added an answer on June 12, 2026 at 6:31 am

    By seeing your log, use this

    JSONObject storeObj = json.getJSONObject("store");
    

    instead of

    JSONArray storeObj = json.getJSONArray("store");
    

    Because store is an JSON object

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

Sidebar

Related Questions

If I have a block of code like this: def show @post = Post.find(params[:id])
I have code like this: string uriString = @C:\Temp\test.html; Uri uri = new Uri(uriString);
i have this code for get data from textfield: <script type=text/javascript> var mod=document.getElementById(mod).value; ajax(mod);
I have this big function (1300+ lines of code) that takes data from the
I've used this code to have a like btn on my site: <iframe src=http://www.facebook.com/plugins/like.php?href=URL_OF_YOUR_WEBSITE&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=80&amp
I have code like this in my view model: function ChatListViewModel(chats) { var self
I have code like this - (IBAction)onClick:(id)sender { NSThread *thread = [[NSThread alloc]initWithTarget:parser selector:@selector(adapter:)
I have code like this var MyObj = { f1 : function(o){ o.onmousedown =
I have code like this: ... entry.KeyPressEvent += EntryKeyPressEvent; ... } void EntryKeyPressEvent(object o,
I have code like this: MediaElement me = myPlayer.MediaElement; WriteableBitmap wb = new WriteableBitmap(me.NaturalVideoWidth,

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.