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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:43:10+00:00 2026-06-12T16:43:10+00:00

I have been creating an app, built on target sdk version 15 and with

  • 0

I have been creating an app, built on target sdk version 15 and with minimum sdk version of 8. Every thing is running perfect when I run it on a devices running version 8. But when I try it on anything higher than version 10 it crashes with a NullPointerException.

The logcat gives me this:

10-06 19:23:12.927: E/AndroidRuntime(589): FATAL EXCEPTION: main
10-06 19:23:12.927: E/AndroidRuntime(589): java.lang.RuntimeException: Unable to start                 activity        ComponentInfo{com.fansheroid.facts.chicks/com.fansheroid.facts.chicks.MainActivity}:   java.lang.NullPointerException
10-06 19:23:12.927: E/AndroidRuntime(589):  at     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.os.Looper.loop(Looper.java:137)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.app.ActivityThread.main(ActivityThread.java:4340)
10-06 19:23:12.927: E/AndroidRuntime(589):  at java.lang.reflect.Method.invokeNative(Native Method)
10-06 19:23:12.927: E/AndroidRuntime(589):  at java.lang.reflect.Method.invoke(Method.java:511)
10-06 19:23:12.927: E/AndroidRuntime(589):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-06 19:23:12.927: E/AndroidRuntime(589):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-06 19:23:12.927: E/AndroidRuntime(589):  at dalvik.system.NativeStart.main(Native Method)
10-06 19:23:12.927: E/AndroidRuntime(589): Caused by: java.lang.NullPointerException
10-06 19:23:12.927: E/AndroidRuntime(589):  at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
10-06 19:23:12.927: E/AndroidRuntime(589):  at org.json.JSONTokener.nextValue(JSONTokener.java:94)
10-06 19:23:12.927: E/AndroidRuntime(589):  at org.json.JSONObject.<init>(JSONObject.java:154)
10-06 19:23:12.927: E/AndroidRuntime(589):  at org.json.JSONObject.<init>(JSONObject.java:171)
10-06 19:23:12.927: E/AndroidRuntime(589):  at com.fansheroid.facts.chicks.MainActivity.getTumblrs(MainActivity.java:156)
10-06 19:23:12.927: E/AndroidRuntime(589):  at com.fansheroid.facts.chicks.MainActivity.onCreate(MainActivity.java:62)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.app.Activity.performCreate(Activity.java:4465)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-06 19:23:12.927: E/AndroidRuntime(589):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
10-06 19:23:12.927: E/AndroidRuntime(589):  ... 11 more

I have been trying to figure out the problem for the past two days, but it just doesn’t make sense for me.

EDIT ADDED CODE

public ArrayList<Tumblr> getTumblrs() throws ClientProtocolException,
        IOException, JSONException {
    String searchUrl = "http://api.tumblr.com/v2/blog/factsandchicks.com/posts?api_key=API_KEY";

    ArrayList<Tumblr> tumblrs = new ArrayList<Tumblr>();

    HttpClient client = new DefaultHttpClient();
    HttpGet get = new HttpGet(searchUrl);

    ResponseHandler<String> responseHandler = new BasicResponseHandler();

    String responseBody = null;
    try {
        responseBody = client.execute(get, responseHandler);
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    JSONObject jsonObject = new JSONObject(responseBody);

    JSONArray posts = jsonObject.getJSONObject("response").getJSONArray(
            "posts");
    for (int i = 0; i < posts.length(); i++) {
        JSONArray photos = posts.getJSONObject(i).getJSONArray("photos");
        for (int j = 0; j < photos.length(); j++) {
            JSONObject photo = photos.getJSONObject(j);
            String url = photo.getJSONArray("alt_sizes").getJSONObject(0)
                    .getString("url");

            Tumblr tumblr = new Tumblr(url);
            tumblrs.add(tumblr);
        }
    }
    return tumblrs;
}

Line 156:

JSONObject jsonObject = new JSONObject(responseBody);
  • 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-12T16:43:11+00:00Added an answer on June 12, 2026 at 4:43 pm

    Solved the problem by using HttpResponse and HttpEntity instead of ResponseHandler, and this solved the problem.

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

Sidebar

Related Questions

I have been creating an app for Android SDK 8 and it works fine.
So i have been creating this framework thing that basically puts together source code
I have been busy creating an app for Red5. Imagine what was my surprise
I have built a CakePHP app for creating appointments against clients and everytime I
I have been creating a gtk+ application in eclipse. At a point in the
I have been creating a peer to peer connection for a new game, that
I have been creating an image gallery with jQuery, all is done. The images
So far I have been creating Web Portal but recently I had a request
I have been investigating about creating a UDP server, at first i though i
I have been reading that creating dependencies by using static classes/singletons in code, is

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.