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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:22:55+00:00 2026-06-04T10:22:55+00:00

I’m building an app that retrieve JSON from URL. At first, I used emulator,

  • 0

I’m building an app that retrieve JSON from URL.
At first, I used emulator, and connect with URL on localhost. (It works perfectly)
and then I want to access the URL from external server. Now there is the problem.

The logcat always like this:

05-17 15:36:48.049: W/System.err(330): java.net.UnknownHostException: culigui.16mb.com
05-17 15:36:48.049: W/System.err(330):  at java.net.InetAddress.lookupHostByName(InetAddress.java:513)
05-17 15:36:48.049: W/System.err(330):  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:278)
05-17 15:36:48.059: W/System.err(330):  at java.net.InetAddress.getAllByName(InetAddress.java:242)
05-17 15:36:48.059: W/System.err(330):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
05-17 15:36:48.059: W/System.err(330):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
05-17 15:36:48.059: W/System.err(330):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
05-17 15:36:48.059: W/System.err(330):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
05-17 15:36:48.059: W/System.err(330):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
05-17 15:36:48.059: W/System.err(330):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
05-17 15:36:48.059: W/System.err(330):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
05-17 15:36:48.069: W/System.err(330):  at last.project.CuliGUI.JSONParser.getJSONFromUrl(JSONParser.java:30)
05-17 15:36:48.069: W/System.err(330):  at last.project.CuliGUI.MenuPromotion.onCreate(MenuPromotion.java:54)
05-17 15:36:48.069: W/System.err(330):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-17 15:36:48.069: W/System.err(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-17 15:36:48.069: W/System.err(330):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-17 15:36:48.069: W/System.err(330):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-17 15:36:48.069: W/System.err(330):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-17 15:36:48.069: W/System.err(330):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 15:36:48.069: W/System.err(330):  at android.os.Looper.loop(Looper.java:123)
05-17 15:36:48.069: W/System.err(330):  at android.app.ActivityThread.main(ActivityThread.java:4627)
05-17 15:36:48.080: W/System.err(330):  at java.lang.reflect.Method.invokeNative(Native Method)
05-17 15:36:48.080: W/System.err(330):  at java.lang.reflect.Method.invoke(Method.java:521)
05-17 15:36:48.080: W/System.err(330):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-17 15:36:48.080: W/System.err(330):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-17 15:36:48.080: W/System.err(330):  at dalvik.system.NativeStart.main(Native Method)
05-17 15:36:48.080: E/Buffer Error(330): Error converting result java.lang.NullPointerException
05-17 15:36:48.089: E/JSON Parser(330): Error parsing data org.json.JSONException: End of input at character 0 of 
05-17 15:36:48.089: D/AndroidRuntime(330): Shutting down VM
05-17 15:36:48.099: W/dalvikvm(330): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-17 15:36:48.118: E/AndroidRuntime(330): FATAL EXCEPTION: main
05-17 15:36:48.118: E/AndroidRuntime(330): java.lang.RuntimeException: Unable to start activity ComponentInfo{last.project.CuliGUI/last.project.CuliGUI.MenuPromotion}: java.lang.NullPointerException
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.os.Looper.loop(Looper.java:123)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.app.ActivityThread.main(ActivityThread.java:4627)
05-17 15:36:48.118: E/AndroidRuntime(330):  at java.lang.reflect.Method.invokeNative(Native Method)
05-17 15:36:48.118: E/AndroidRuntime(330):  at java.lang.reflect.Method.invoke(Method.java:521)
05-17 15:36:48.118: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-17 15:36:48.118: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-17 15:36:48.118: E/AndroidRuntime(330):  at dalvik.system.NativeStart.main(Native Method)
05-17 15:36:48.118: E/AndroidRuntime(330): Caused by: java.lang.NullPointerException
05-17 15:36:48.118: E/AndroidRuntime(330):  at last.project.CuliGUI.MenuPromotion.onCreate(MenuPromotion.java:58)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-17 15:36:48.118: E/AndroidRuntime(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

I noticed that there is a problem with java.net.UnknownHostException. I’ve read some article about it but honestly I didn’t understand.

This is my activity, in case some of you need it:

// connect to external server
private static String url = "http://culigui.16mb.com/getdataresto.php";

ListView Listview;
LazyAdapter adapter;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.menu_view_all);

    // Hashmap for ListView
    ArrayList<HashMap<String, String>> userList = new ArrayList<HashMap<String, String>>();

    // Creating JSON Parser instance
    JSONParser jParser = new JSONParser();

    // getting JSON string from URL
    JSONObject json = jParser.getJSONFromUrl(url);

    try {
        // Getting JSONArray of listresto
        JSONArray  listresto = json.getJSONArray("listresto");

        // looping through All listresto
        for(int i = 0; i < listresto.length(); i++){
            HashMap<String, String> map = new HashMap<String, String>();    
            JSONObject list = listresto.getJSONObject(i);

            // insert String to Local Variable
            map.put("KEY_ID", list.getString("id_resto"));
            map.put("KEY_NAME", list.getString("nama_resto"));
            map.put("KEY_ADDRESS", list.getString("alamat_resto"));
            map.put("KEY_THUMB", list.getString("thumb_img"));
            map.put("KEY_ABOUT", list.getString("about_resto"));
            map.put("KEY_PHONE", list.getString("no_telp"));
            map.put("KEY_LAT", list.getString("loc_lat"));
            map.put("KEY_LONG", list.getString("loc_long"));
            userList.add(map);

            //for checking value
            //System.out.println("output: " +map);

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


    /**
     * Updating parsed JSON data into ListView
     * */

    //this is new custom adapter
    Listview = (ListView) findViewById (R.id.list);
    adapter = new LazyAdapter(this, userList); 
    Listview.setAdapter(adapter);
  • 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-04T10:22:57+00:00Added an answer on June 4, 2026 at 10:22 am

    It looks like it simply can’t get to that URL from the machine it’s running on. Can you browse to the URL on the external server that is running the application?

    To troubleshoot:

    • Ensure you can access the URL from an external machine of a different network to the one you are currently connected.
    • If working, check that the device/emulator you are using can access the same URL, if not – then you have a problem with the proxy that the emulator is using (they should normally route through the same network connection used by the host OS).
    • If the device/emulator is failing, then try switching it to a different network, or review their own help documentation.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from

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.