flyhigh427
Member
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]
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]