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

Apps Database

Hi all,

Im a beginner of android. Working on eclipse juno, gingerbread 2.3
im developing an app which helps doctors store information about their patients. I get the error force close on emulator when i include the code -

public class DBUtil {

private static final int DB_VERSION=6;
private Context context;
private SQLiteDatabase db;

public DBUtil(Context context)
{
this.context = context;
//causing error------------------------------------
OpenHelper openHelper = new OpenHelper(context);
db = openHelper.getWritableDatabase();
//--------------------------------------------------

}


public class Doctors extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.doctors);
final Context context = this;
Button b2 = (Button) findViewById(R.id.button2);
Button b3 = (Button) findViewById(R.id.button3);
final DBUtil dh = new DBUtil(context);

ArrayList<ClassDoctor> doctor = dh.listDoctors();
String all[] = new String[doctor.size()];
for(int i=0; i<doctor.size(); i++)
{
all = doctor.get(i).getName();
}
...
can anyone please help me to fix the error..
 
Hello, could you please place your code inside
Code:
 tags? This causes it to retain its formatting and makes it much easier to read.
 
Back
Top Bottom