Call a non static methode in a static SQLiteDatabase class

Posted by Fevos on Stack Overflow See other posts from Stack Overflow or by Fevos
Published on 2010-03-30T16:41:42Z Indexed on 2010/03/30 16:43 UTC
Read the original article Hit count: 477

Filed under:
|
|

i want to display a msg to the user (msg box or Toast) when exception happend in a static SQLite Database class that i use.

the proplem is that i cant call a non static methode in a static class , how can i handle this.

this is the class

private static SQLiteDatabase getDatabase(Context aContext) {

and i want to add something like this in the class when exception happen but context genertae the problem of reference to non static in static class.

    Context context = getApplicationContext();
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;

Toast toast = Toast.makeText(context, text, duration);
toast.show();

© Stack Overflow or respective owner

Related posts about java

Related posts about android