-1

hiii... im new in android application development. I built an application that connect or mysql database, but when I run it on my device it stops and I get this log:

12-09 04:50:00.965: D/AndroidRuntime(1819): Shutting down VM
12-09 04:50:00.965: W/dalvikvm(1819): threadid=1: thread exiting with uncaught exception (group=0xb3b09ba8)
12-09 04:50:00.975: E/AndroidRuntime(1819): FATAL EXCEPTION: main
12-09 04:50:00.975: E/AndroidRuntime(1819): Process: com.customerservice.mobilebanking, PID: 1819
12-09 04:50:00.975: E/AndroidRuntime(1819): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.customerservice.mobilebanking/com.customerservice.mobilebanking.Select}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.os.Handler.dispatchMessage(Handler.java:102)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.os.Looper.loop(Looper.java:136)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.ActivityThread.main(ActivityThread.java:5017)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at java.lang.reflect.Method.invokeNative(Native Method)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at java.lang.reflect.Method.invoke(Method.java:515)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at dalvik.system.NativeStart.main(Native Method)
12-09 04:50:00.975: E/AndroidRuntime(1819): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.ListActivity.onContentChanged(ListActivity.java:243)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:293)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.Activity.setContentView(Activity.java:1929)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at com.customerservice.mobilebanking.Select.onCreate(Select.java:62)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.Activity.performCreate(Activity.java:5231)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-09 04:50:00.975: E/AndroidRuntime(1819):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
12-09 04:50:00.975: E/AndroidRuntime(1819):  ... 11 more
12-09 04:51:34.605: W/ActivityThread(1855): Application com.customerservice.mobilebanking is waiting for the debugger on port 8100...
12-09 04:51:34.685: I/System.out(1855): Sending WAIT chunk
12-09 04:51:34.985: I/dalvikvm(1855): Debugger is active
12-09 04:51:35.135: I/System.out(1855): Debugger has connected
12-09 04:51:35.135: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:35.345: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:35.545: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:35.765: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:35.965: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:36.185: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:36.395: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:36.595: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:36.795: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:36.995: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:37.205: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:37.415: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:37.605: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:37.805: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:38.015: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:38.245: I/System.out(1855): waiting for debugger to settle...
12-09 04:51:38.445: I/System.out(1855): debugger has settled (1445)
12-09 04:51:40.125: D/dalvikvm(1855): GC_FOR_ALLOC freed 69K, 5% free 2847K/2980K, paused 42ms, total 42ms
12-09 04:51:40.125: I/dalvikvm-heap(1855): Grow heap (frag case) to 3.318MB for 500416-byte allocation
12-09 04:51:40.195: D/dalvikvm(1855): GC_FOR_ALLOC freed <1K, 4% free 3335K/3472K, paused 58ms, total 58ms
12-09 04:54:32.495: W/jdwp(1855): Debugger is telling the VM to exit with code=1
12-09 04:54:32.495: I/dalvikvm(1855): GC lifetime allocation: 16104 bytes
12-09 04:54:34.525: D/dalvikvm(1889): GC_FOR_ALLOC freed 72K, 5% free 2846K/2984K, paused 84ms, total 88ms
12-09 04:54:34.525: I/dalvikvm-heap(1889): Grow heap (frag case) to 3.317MB for 500416-byte allocation
12-09 04:54:34.595: D/dalvikvm(1889): GC_FOR_ALLOC freed 2K, 5% free 3333K/3476K, paused 61ms, total 61ms
12-09 04:54:34.745: D/AndroidRuntime(1889): Shutting down VM
12-09 04:54:34.745: W/dalvikvm(1889): threadid=1: thread exiting with uncaught exception (group=0xb3b09ba8)
12-09 04:54:34.765: E/AndroidRuntime(1889): FATAL EXCEPTION: main
12-09 04:54:34.765: E/AndroidRuntime(1889): Process: com.customerservice.mobilebanking, PID: 1889
12-09 04:54:34.765: E/AndroidRuntime(1889): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.customerservice.mobilebanking/com.customerservice.mobilebanking.Select}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.os.Handler.dispatchMessage(Handler.java:102)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.os.Looper.loop(Looper.java:136)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.ActivityThread.main(ActivityThread.java:5017)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at java.lang.reflect.Method.invokeNative(Native Method)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at java.lang.reflect.Method.invoke(Method.java:515)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at dalvik.system.NativeStart.main(Native Method)
12-09 04:54:34.765: E/AndroidRuntime(1889): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.ListActivity.onContentChanged(ListActivity.java:243)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:293)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.Activity.setContentView(Activity.java:1929)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at com.customerservice.mobilebanking.Select.onCreate(Select.java:62)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.Activity.performCreate(Activity.java:5231)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-09 04:54:34.765: E/AndroidRuntime(1889):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
12-09 04:54:34.765: E/AndroidRuntime(1889):  ... 11 more
12-09 04:55:02.655: I/Process(1889): Sending signal. PID: 1889 SIG: 9
12-09 04:59:02.135: D/dalvikvm(1928): GC_FOR_ALLOC freed 76K, 5% free 2846K/2988K, paused 45ms, total 47ms
12-09 04:59:02.135: I/dalvikvm-heap(1928): Grow heap (frag case) to 3.317MB for 500416-byte allocation
12-09 04:59:02.235: D/dalvikvm(1928): GC_FOR_ALLOC freed 2K, 5% free 3333K/3480K, paused 91ms, total 91ms
12-09 04:59:02.315: D/AndroidRuntime(1928): Shutting down VM
12-09 04:59:02.315: W/dalvikvm(1928): threadid=1: thread exiting with uncaught exception (group=0xb3b09ba8)
12-09 04:59:02.335: E/AndroidRuntime(1928): FATAL EXCEPTION: main
12-09 04:59:02.335: E/AndroidRuntime(1928): Process: com.customerservice.mobilebanking, PID: 1928
12-09 04:59:02.335: E/AndroidRuntime(1928): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.customerservice.mobilebanking/com.customerservice.mobilebanking.Select}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.os.Handler.dispatchMessage(Handler.java:102)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.os.Looper.loop(Looper.java:136)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.ActivityThread.main(ActivityThread.java:5017)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at java.lang.reflect.Method.invokeNative(Native Method)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at java.lang.reflect.Method.invoke(Method.java:515)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at dalvik.system.NativeStart.main(Native Method)
12-09 04:59:02.335: E/AndroidRuntime(1928): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.ListActivity.onContentChanged(ListActivity.java:243)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:293)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.Activity.setContentView(Activity.java:1929)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at com.customerservice.mobilebanking.Select.onCreate(Select.java:62)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.Activity.performCreate(Activity.java:5231)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-09 04:59:02.335: E/AndroidRuntime(1928):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
12-09 04:59:02.335: E/AndroidRuntime(1928):  ... 11 more
12-09 04:59:05.965: I/Process(1928): Sending signal. PID: 1928 SIG: 9
12-09 05:03:03.155: W/ActivityThread(1979): Application com.customerservice.mobilebanking is waiting for the debugger on port 8100...
12-09 05:03:03.205: I/System.out(1979): Sending WAIT chunk
12-09 05:03:03.225: I/dalvikvm(1979): Debugger is active
12-09 05:03:03.465: I/System.out(1979): Debugger has connected
12-09 05:03:03.465: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:03.685: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:04.005: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:04.225: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:04.435: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:04.635: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:04.835: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:05.035: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:05.245: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:05.445: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:05.655: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:05.845: I/System.out(1979): waiting for debugger to settle...
12-09 05:03:06.055: I/System.out(1979): debugger has settled (1335)
12-09 05:03:08.675: D/dalvikvm(1979): GC_FOR_ALLOC freed 81K, 5% free 2847K/2992K, paused 77ms, total 78ms
12-09 05:03:08.675: I/dalvikvm-heap(1979): Grow heap (frag case) to 3.318MB for 500416-byte allocation
12-09 05:03:08.795: D/dalvikvm(1979): GC_FOR_ALLOC freed <1K, 5% free 3335K/3484K, paused 96ms, total 96ms

This is my code

package com.customerservice.mobilebanking;

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

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

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class Select extends ListActivity {
 
    EditText txtic;
 Button btnsearch;
   
    // Progress Dialog
    private ProgressDialog pDialog;
 
    // JSON parser class
    JSONParser jsonParser = new JSONParser();
    
    ArrayList<HashMap<String, String>> CustomerSelect;
 
    // single product url
    private static final String CONNECT_URL = "http://10.0.2.2:8080/select.php";
    
    // JSON Node names
    private static final String TAG_SUCCESS = "success";
    private static final String TAG_CUSTOMER = "customer";
    //private static final String TAG_MESSAGE = "message";
    private static final String TAG_ID = "cid";
    private static final String TAG_NAME = "cus_name";
    private static final String TAG_GENDER = "gender";
    private static final String TAG_ACCOUNT = "acc_no";
    private static final String TAG_ADDRESS = "address";
    private static final String TAG_PHONE = "phone";
    
    //customer JSONArray
    JSONArray customer = null;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view2);
        
        //hashmap for listview
        CustomerSelect = new ArrayList<HashMap<String, String>> ();
        
        //get listview
        ListView lv = getListView();
        
        //on selecting data
        //launcing Edit Customer info screen
        
        lv.setOnItemClickListener(new OnItemClickListener() {
            
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
             //get values from selected ListItem
             String cid = ((TextView) view.findViewById(R.id.lcid)).getText().toString();
             
             //starting new intent
             Intent in = new Intent (getApplicationContext(), Update.class);
             
             //send cid to next activity
             in.putExtra(TAG_ID, cid);
             
             //starting new activity and expecting some response back
             startActivityForResult(in, 100);
            }
        });
        
           
        //search button
        btnsearch = (Button) findViewById(R.id.finddata);
        
        //get ic number
        txtic = (EditText) findViewById(R.id.Cic);
        
        // search button click event
        btnsearch.setOnClickListener(new View.OnClickListener() {
 
            @Override
            public void onClick(View arg0) {
                // starting background task to get customer data
                new GetData().execute();
            }
        });
     }
    
    /**
     * Background Async Task to Get required data
     * */
    class GetData extends AsyncTask<String, String, String> {
     
  /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(Select.this);
            pDialog.setMessage("Loading data. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }
     
        /**
         * Getting required data in background thread
         * */
  @Override
  protected String doInBackground(String... args) {
            
         //get data from EditText for customer ic no
         String Sic = txtic.getText().toString();
         
         //Building parameters
      List<NameValuePair> params = new ArrayList<NameValuePair>();
      
      params.add(new BasicNameValuePair("ic", Sic));
      
      //Getting JSON string from URL
      JSONObject json = jsonParser.makeHttpRequest(CONNECT_URL, "POST", params);
           
         try {

             //Checking for SUCCESS TAG
             int success = json.getInt(TAG_SUCCESS);

             if (success == 1) {
              
              //customer data found
              //get Array of data
              customer = json.getJSONArray(TAG_CUSTOMER);
              JSONObject c = customer.getJSONObject(0);
                                   
                 
                 //storing each json item in variable
                 String id = c.getString(TAG_ID);
                 String name = c.getString(TAG_NAME);
                 String gender = c.getString(TAG_GENDER);
                 String account = c.getString(TAG_ACCOUNT);
                 String address = c.getString(TAG_ADDRESS);
                 String phone = c.getString(TAG_PHONE);
                 
                 //creating new HashMap
                 HashMap<String, String> map = new HashMap<String, String> ();
                 
                 map.put(TAG_ID, id);
                 map.put(TAG_NAME, name);
                 map.put(TAG_GENDER, gender);
                 map.put(TAG_ACCOUNT, account);
                 map.put(TAG_ADDRESS, address);
                 map.put(TAG_PHONE, phone);
                 
                 //adding HashList to ArrayList
                 CustomerSelect.add(map);
                
             }else{
                 //No data found
              //launch insert new customer data
                 Intent i = new Intent(getApplicationContext(), Insert.class);
                 //closing all previous activities
                 i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                 startActivity(i);
                
             }

         } catch (JSONException e) {
          e.printStackTrace();
          
         }
         
   return null;
  }
  
  /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog after getting customer data
            pDialog.dismiss();
            //updating UI from Background Thread
            
            runOnUiThread(new Runnable() {
             public void run () {
              /**
               * Updating parsed JSON data into ListView
               */
              ListAdapter adapter = new SimpleAdapter (Select.this, CustomerSelect, 
                R.layout.list_item, new String[] { TAG_ID, TAG_NAME, TAG_GENDER,
                TAG_ACCOUNT, TAG_ADDRESS, TAG_PHONE }, new int[] { R.id.lcid, R.id.lname,
                R.id.lgender, R.id.laccount, R.id.laddress, R.id.lphone });
              //updating listview
              setListAdapter(adapter);
             } 
            });
            
        }
     
    }
       
}

what does it mean by W/dalvikvm(1819): threadid=1: thread exiting with uncaught exception (group=0xb3b09ba8)

there is nothing error in my java coding but i still cannot run in my device... some please help me.

MSR
  • 13
  • 5

2 Answers2

0

Your answer is in Logcat: Your content must have a ListView whose id attribute is 'android.R.id.list'. So in your layout which you provide to setContentView of Activity you do not have ListView whose id is android.R.id.list. Your ListView in XML defining layout should have android:id="@android:id/list"

michal.z
  • 2,025
  • 1
  • 15
  • 10
0

the list view which you have defined your layout you are suppose to give the id as

android:id="@android:id/list"