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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:49:07+00:00 2026-06-18T19:49:07+00:00

I am getting these errors on my LogCat : 02-13 18:52:12.742: E/AndroidRuntime(428): FATAL EXCEPTION:

  • 0

I am getting these errors on my LogCat :

02-13 18:52:12.742: E/AndroidRuntime(428): FATAL EXCEPTION: main
02-13 18:52:12.742: E/AndroidRuntime(428): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thesis.menubook/com.thesis.menubook.MenuMain}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1748)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.ActivityThread.access$1500(ActivityThread.java:122)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.os.Looper.loop(Looper.java:132)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.ActivityThread.main(ActivityThread.java:4025)
02-13 18:52:12.742: E/AndroidRuntime(428):  at java.lang.reflect.Method.invokeNative(Native Method)
02-13 18:52:12.742: E/AndroidRuntime(428):  at java.lang.reflect.Method.invoke(Method.java:491)
02-13 18:52:12.742: E/AndroidRuntime(428):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
02-13 18:52:12.742: E/AndroidRuntime(428):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
02-13 18:52:12.742: E/AndroidRuntime(428):  at dalvik.system.NativeStart.main(Native Method)
02-13 18:52:12.742: E/AndroidRuntime(428): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:688)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
02-13 18:52:12.742: E/AndroidRuntime(428):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:223)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.Activity.setContentView(Activity.java:1780)
02-13 18:52:12.742: E/AndroidRuntime(428):  at com.thesis.menubook.MenuMain.onCreate(MenuMain.java:16)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
02-13 18:52:12.742: E/AndroidRuntime(428):  ... 11 more
02-13 18:52:12.742: E/AndroidRuntime(428): Caused by: android.os.NetworkOnMainThreadException
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1077)
02-13 18:52:12.742: E/AndroidRuntime(428):  at dalvik.system.BlockGuard$WrappedNetworkSystem.connect(BlockGuard.java:368)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:208)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:431)
02-13 18:52:12.742: E/AndroidRuntime(428):  at java.net.Socket.connect(Socket.java:901)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:143)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
02-13 18:52:12.742: E/AndroidRuntime(428):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
02-13 18:52:12.742: E/AndroidRuntime(428):  at com.thesis.menubook.JSONParser.makeHttpRequest(JSONParser.java:62)
02-13 18:52:12.742: E/AndroidRuntime(428):  at com.thesis.menubook.MenuCategory.onCreate(MenuCategory.java:41)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:702)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:905)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:983)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.app.Activity.onCreateView(Activity.java:4141)
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:664)
02-13 18:52:12.742: E/AndroidRuntime(428):  ... 20 more
02-13 18:52:13.241: D/dalvikvm(428): GC_CONCURRENT freed 335K, 6% free 7443K/7879K, paused 10ms+10ms
02-13 18:52:23.632: I/Process(428): Sending signal. PID: 428 SIG: 9

And I am guessing that this particular line is causing my application to force close :

02-13 18:52:12.742: E/AndroidRuntime(428): Caused by: android.os.NetworkOnMainThreadException
02-13 18:52:12.742: E/AndroidRuntime(428):  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1077)

Any ideas what is causing this? Here is my java file :

package com.thesis.menubook;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.annotation.TargetApi;
import android.app.ListFragment;
import android.app.ProgressDialog;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.SimpleAdapter;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class MenuCategory extends ListFragment {
    JSONParser jsonParser = new JSONParser();
    ArrayList<HashMap<String, String>> categoryList;
    private ProgressDialog pDialog;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        // LOAD CATEGORY ONTO LIST

        Bundle b = getActivity().getIntent().getExtras();
        String table_ID = b.getString("Table");
        String ipaddress = b.getString("IPAddress");

        List<NameValuePair> params = new ArrayList<NameValuePair>();
        Log.d("IP ADDRESS", ipaddress +" ");

            //CODE FAILS HERE 

        JSONObject json = jsonParser.makeHttpRequest("http://"+ipaddress+"/MenuBook/selectCategories.php", "GET", params);

        // Check your log cat for JSON reponse
        Log.d("All Categories: ", json.toString() + " ");

        try {
            // Checking for SUCCESS TAG
            int success = json.getInt("success");

            if (success == 1) {
                // products found
                // Getting Array of Products

                JSONArray category_list = json.getJSONArray("category_list");

                // looping through All Products
                for (int j = 0; j < category_list.length(); j++) {
                    JSONObject c = category_list.getJSONObject(j);

                    // Storing each json item in variable
                    String category = c.getString("category");


                    // creating new HashMap
                    HashMap<String, String> map = new HashMap<String, String>();

                    // adding each child node to HashMap key => value
                    map.put("category", category);
                    int num = 1;
                    Log.d("category #"+num+"", category);
                    num++;
                    // adding HashList to ArrayList
                    if(categoryList.contains(map) != true)
                    {
                        categoryList.add(map);
                    }
                }
            } 
        } catch (JSONException e) {
            e.printStackTrace();
        }
        ArrayAdapter<ArrayList<HashMap<String, String>>> arrayAdapter = new ArrayAdapter<ArrayList<HashMap<String, String>>>(getActivity().
                getApplicationContext(), R.layout.activity_menu_category);
        arrayAdapter.add(categoryList);
        setListAdapter(arrayAdapter);
    }



}
  • 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-18T19:49:08+00:00Added an answer on June 18, 2026 at 7:49 pm

    You are making an HTTP request in your Fragment’s onCreate(). This is a very bad idea, and is quite rightly causing the system to complain. You have no idea how long the network request will take to complete, and in the meantime the UI thread is blocked waiting for the result.

    From the documentation:

    Do not block the UI thread

    Network activity should happen in a background thread. Have a look at ASyncTask or IntentService.

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

Sidebar

Related Questions

While running the application I'm getting these errors 10-09 10:20:57.138: ERROR/AndroidRuntime(282): java.lang.RuntimeException: Unable to
Getting these errors in some java code http://tutorials.jenkov.com/java-multithreaded-servers/multithreaded-server.html Exception in thread Thread-0 java.lang.RuntimeException: Cannot
I keep getting these 2 errors in my code In function 'int main()': error:
I've been getting these errors intermittently from sending email from my django app. I
Using an opencart plugin I am getting these errors in my apache error log
Hello I am getting these LNK errors when I try to compile my MySQL
I'm getting loads of these errors reported when a user tries to download a
I keep getting these errors when trying to delete rows from a table. The
I'm getting these errors in the console: 2010-01-07 18:15:19.036 FlagLearner[13310:207] *** -[NSCFString objectForKey:]: unrecognized
Since I've been getting these errors: [xcb] Unknown request in queue while dequeuing [xcb]

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.