• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps fatal excption erorr help needed

morning
im getting this error

your content must have a listview whos id attribute is
android.R.id.
list



ive been trying for a while ,could use some pointers.

i also have another question
can this type of database handle 61 items in it?

thanks



[HIGH]
package com.my.supplys;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class SupplyMainActivity extends ListActivity {


protected String tableName = DatabaseHelper.tableName;
protected SQLiteDatabase db;
protected Cursor cursor;
protected ListAdapter adapter;



@Override
public void onCreate(Bundle savedInstanceState) {
// Android specific calls
super.onCreate(savedInstanceState);
setContentView(R.layout.supply_main);
// create the database manager object
db = (new DatabaseHelper(this)).getWritableDatabase();


// Map all the titles into the ViewTitleNotes TextView
String[] from = new String[] { tableName };
int[] to = new int[] { android.R.id.list };


// Create an Adapter
adapter = new SimpleCursorAdapter(SupplyMainActivity.this,
R.layout.supply_main, cursor, from, to);


// Set the Adapter
setListAdapter(adapter);

}

public void onListItemClick(ListView parent, View view, int position, long id) {
Intent intent = new Intent(this, EmployeeDetails.class);
Cursor cursor = (Cursor) adapter.getItem(position);
intent.putExtra("tableNameId", cursor.getInt(cursor.getColumnIndex("_id")));
startActivity(intent);
}




}

[/HIGH]
 
hi hope yall didnt eat to much like i did..
my question
do we have to put the path to the database like this?
DBPath = "/data/data/" + context.getPackageName() + "/databases";

or is it not needed
thanks
 
Back
Top Bottom