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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:10:28+00:00 2026-05-27T23:10:28+00:00

There is an app where I’m working on for 1 week right now. Unfortunately

  • 0

There is an app where I’m working on for 1 week right now. Unfortunately there is an error that is hard to solve because I really don’t know what to do right now. See below a copy of the LogCat list.

01-04 00:14:23.662: E/log_tag(3073): Error in http connectionandroid.os.NetworkOnMainThreadException
01-04 00:14:23.662: E/log_tag(3073): Error converting result java.lang.NullPointerException
01-04 00:14:23.672: D/AndroidRuntime(3073): Shutting down VM
01-04 00:14:23.672: W/dalvikvm(3073): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
01-04 00:14:23.692: E/AndroidRuntime(3073): FATAL EXCEPTION: main
01-04 00:14:23.692: E/AndroidRuntime(3073): java.lang.RuntimeException: Unable to start activity ComponentInfo{united.aristal.freewallet/united.aristal.freewallet.GroupHistory}: java.lang.NullPointerException
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.ActivityThread.access$600(ActivityThread.java:122)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.os.Looper.loop(Looper.java:137)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.ActivityThread.main(ActivityThread.java:4340)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at java.lang.reflect.Method.invokeNative(Native Method)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at java.lang.reflect.Method.invoke(Method.java:511)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at dalvik.system.NativeStart.main(Native Method)
01-04 00:14:23.692: E/AndroidRuntime(3073): Caused by: java.lang.NullPointerException
01-04 00:14:23.692: E/AndroidRuntime(3073):     at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at org.json.JSONTokener.nextValue(JSONTokener.java:94)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at org.json.JSONArray.<init>(JSONArray.java:87)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at org.json.JSONArray.<init>(JSONArray.java:103)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at united.aristal.freewallet.GroupHistory.retrieveGroupInfo(GroupHistory.java:295)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at united.aristal.freewallet.GroupHistory.onCreate(GroupHistory.java:95)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.Activity.performCreate(Activity.java:4465)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-04 00:14:23.692: E/AndroidRuntime(3073):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
01-04 00:14:23.692: E/AndroidRuntime(3073):     ... 11 more

Copy of the script where the current problem exists:

/********************************************************************
* RETRIEVING GROUP INFO                                             *
*********************************************************************/
public void retrieveGroupInfo(){

    try{
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("link");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity();
        is = entity.getContent();
        }
    catch(Exception e){
        Log.e("log_tag", "Error in http connection"+e.toString());
    }

    try{
        BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
            sb = new StringBuilder();
            sb.append(reader.readLine() + "\n");
            String line="0";

            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n\n");
            }

            is.close();
            result = sb.toString();
    }
    catch(Exception e){
        Log.e("log_tag", "Error converting result "+e.toString());
    }

    try{
        jArray = new JSONArray(result);
        JSONObject json_data=null;

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

            json_data               = jArray.getJSONObject(i);     

            retrievedId.add(json_data.getInt("id"));
            String getDate          = recoverDate(json_data.getString("date"));
            String getTime          = json_data.getString("time");
            String getCategory      = json_data.getString("category");
            String getObjectName    = json_data.getString("object_name");
            String getObjectVal     = json_data.getString("object_value");
            String getValType       = json_data.getString("value_type");
            //String getUsername        = json_data.getString("username");

            historyItems.add(
                    getCategory + "\t: " + getObjectName + "\n" + 
                    "Price\t: € " + getObjectVal + "\n" +
                    "Date\t: " + getDate + " " + getTime);

            historyValueType.add(getValType);
        }

        ListView lv = (ListView) findViewById(R.id.listViewMenu);
            lv.setAdapter(fancyAdapter);

            lv.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {

                    alertdialogUpdateDelete(position);
                    //showToast(historyItem.get(position).toString());
                }
            });
    }
    catch(JSONException e1){
        //Toast.makeText(getBaseContext(), "No Record Found." ,Toast.LENGTH_LONG).show();
    } 
    catch (ParseException e1) {
            e1.printStackTrace();
    }

}

I’m really frustrated right now and stuck for a couple hours, so please help me. I’m not sure but I think that there is some problem with a thread or something? Thanx for helping me out here.

  • 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-27T23:10:28+00:00Added an answer on May 27, 2026 at 11:10 pm

    Your code is trying to make a network connection on the main thread. This is not allowed in Android; that’s why you are receiving an android.os.NetworkOnMainThreadException when you try to connect. After you catch the exception and log it, your code still tries to use it, which is causing the following problems. (You should probably report failure and skip trying to read the connection if you catch an exception when making the connection.)

    The solution is to move your network activities to a worker thread. An AsyncTask is a nice way to do this. Read the guide topic Processes and Threads and the blog entry Painless threading for more info.

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

Sidebar

Related Questions

In my app there is requirement that..I have 6 buttons in a nib, when
I'm coding an app that works much like Apple's Weather.app: There's a UIPageControl at
I understood that in order to use cookies inside of phonegap native app there
So, I'm working on a mapping application. In the app there are these toolbars
Is there an app (preferable a Mac app) that will turn an area of
Is there an app for Android Tablets (I have the Toshiba THRiVE) that I
In my app there's a uiwebview that loads a URL. I am using the
In my flex app there's an item renderer for a TileList that I am
On every windows app there is that context menu that you can access with
In my app there's a static variable that's being set to null when I

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.