How can I Access Database in BroadcastReceiver Class in Android?
问题 I have a BroadcastReceiver class to receive incoming call. I want to compare the incoming number with a numbers from my database. Now I can't understand how to use database in BroadcastReceiver class. I make object of DBAdapter class in onReceive() method in this way: @Override public void onReceive(Context context, Intent intent) { DBAdapter db = new DBAdapter(contenxt); Cursor c = d.getAllData(); while(c.moveToFirst){ do{ Log.v("Data : "+c.getString(2)); } while(c.moveToNext); } } Above