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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:15:18+00:00 2026-06-06T06:15:18+00:00

i got this error in the logcat 06-21 11:58:27.275: E/AndroidRuntime(404): java.lang.RuntimeException: Unable to start

  • 0

i got this error in the logcat

06-21 11:58:27.275: E/AndroidRuntime(404): java.lang.RuntimeException: Unable to start activity ComponentInfo{App.Biodata/App.Biodata.viewdata}: java.lang.NullPointerException
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.os.Looper.loop(Looper.java:123)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-21 11:58:27.275: E/AndroidRuntime(404):  at java.lang.reflect.Method.invokeNative(Native Method)
06-21 11:58:27.275: E/AndroidRuntime(404):  at java.lang.reflect.Method.invoke(Method.java:521)
06-21 11:58:27.275: E/AndroidRuntime(404):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-21 11:58:27.275: E/AndroidRuntime(404):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-21 11:58:27.275: E/AndroidRuntime(404):  at dalvik.system.NativeStart.main(Native Method)
06-21 11:58:27.275: E/AndroidRuntime(404): Caused by: java.lang.NullPointerException
06-21 11:58:27.275: E/AndroidRuntime(404):  at App.Biodata.viewdata.onCreate(viewdata.java:42)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-21 11:58:27.275: E/AndroidRuntime(404):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-21 11:58:27.275: E/AndroidRuntime(404):  ... 11 more

java file:

package App.Biodata;

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

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;


public class viewdata extends ListActivity {

private static String link_url = "http://10.0.2.2/biodatawebservice/view.php";

private static final String BIO_NAMA = "nama";
private static final String BIO_ALAMAT = "alamat";
private static final String BIO_TGLLAHIR = "tgl_lahir";
private static final String BIO_JK = "jk";
private static final String BIO_EMAIL = "email";    
private static final String BIO_PHONE = "phone";

JSONArray biodata = null;

ArrayList<HashMap<String, String>> daftar_biodata = new ArrayList<HashMap<String, String>>();

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.viewdata);
    
    JSONParser jParser = new JSONParser();

    JSONObject json = jParser.AmbilJson(link_url);
    
    try {
        biodata = json.getJSONArray("biodata");
        
        for(int i = 0; i < biodata.length(); i++){
            JSONObject bio = biodata.getJSONObject(i);
            
            String nama = bio.getString(BIO_NAMA);
            String alamat = bio.getString(BIO_ALAMAT);
            String tgl_lahir = bio.getString(BIO_TGLLAHIR);
            String jk = bio.getString(BIO_JK);
            String email = bio.getString(BIO_EMAIL);
            String phone = bio.getString(BIO_PHONE);
            
            HashMap<String, String> map = new HashMap<String, String>();

            map.put(BIO_NAMA, nama);
            map.put(BIO_ALAMAT, alamat);
            map.put(BIO_TGLLAHIR, tgl_lahir);
            map.put(BIO_JK, jk);
            map.put(BIO_EMAIL, email);
            map.put(BIO_PHONE, phone);

            daftar_biodata.add(map);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    this.adapter_listview();
}       

private void adapter_listview() {
    // TODO Auto-generated method stub
    ListAdapter adapter = new SimpleAdapter(this, daftar_biodata,
            R.layout.list_data,
            new String[] {  BIO_NAMA, BIO_ALAMAT, BIO_TGLLAHIR, BIO_JK, BIO_EMAIL, BIO_PHONE}, new int[] {
                    R.id.txtNama, R.id.txtAlamat, R.id.txtTgllahir, R.id.txtJK, R.id.txtEmail,R.id.txtPhone});

    setListAdapter(adapter);
    ListView lv = getListView();


}

}

xml file for listactivity:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

</LinearLayout>

xml for each item:

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="10dp" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5dp"
        android:text="Nama"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFF" />

    <TextView
        android:id="@+id/txtNama"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#333"
        android:text=" "
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="10dp" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5dp"
        android:text="Alamat"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFF" />

    <TextView
        android:id="@+id/txtAlamat"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#333"
        android:text=" "
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="10dp" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5dp"
        android:text="Tanggal Lahir"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFF" />

    <TextView
        android:id="@+id/txtTgllahir"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#333"
        android:text=" "
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="10dp" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5dp"
        android:text="Jenis Kelamin"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFF" />

    <TextView
        android:id="@+id/txtJK"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#333"
        android:text=" "
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="10dp" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5dp"
        android:text="Telepon"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFF" />

    <TextView
        android:id="@+id/txtPhone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#333"
        android:text=" "
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="10dp" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5dp"
        android:text="Email"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FFF" />

    <TextView
        android:id="@+id/txtEmail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#333"
        android:text=" "
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>


</LinearLayout>

i cant find what wrong with this app, can someone tell me why this app force closing?
i already read some of answer here tell that it have something wrong with the xml layout file, but still cant find solution

thanks in advance.

[SOLVED]

thank you very much stackoverflow.com members for helping me out,
the problem is this

biodata = json.getJSONArray("biodata");

is null, because my php fail.

  • 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-06T06:15:19+00:00Added an answer on June 6, 2026 at 6:15 am

    json is null so NPE.You cant get JsonObject from your JsonParser.

    biodata = json.getJSONArray("biodata");//here json is null.
    

    and check your json = jParser.AmbilJson(link_url);

    AND no use of ListView lv = getListView(); after setAdapter to listview.

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

Sidebar

Related Questions

I got this error 'java.lang.ClassNotFoundException: com.hp.hpl.jena.rdf.model.Model' when I run my java web service which
I have got this logcat error more then one time. This time I started
I got this error when trying to Archive for distribution. My app builds fine
I have got this error Unable to connect to the remote server when I
I got this error message in android LogCat 04-24 21:14:02.603: W/System.err(831): org.json.JSONException: Value {id:602414132,first_name:Adham,username:adham.enaya,locale:en_GB,link:http:\/\/www.facebook.com\/adham.enaya,name:Adham
Got this error on a big $_GET query in size ~9 000 symbols (they
Got this error message while trying to configure an entitydatasource in the designer: My
I got this error for a collection I am writing, but fxcop warned me
I got this error twice. it says error: redefinition of '-[SampleTableViewController tableView:cellForRowAtIndexPath:]'
I got this error running a query that goes against 2 tables with combined

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.