java - run startService in static method -
i have function static method:
public static void engine(sqlitedatabase mydb){ intent intent = new intent(context, gpslocation.class); intent.putextra("sql_obj", mydb); startservice(intent); }
but startservice return follow error:
cannot make static reference non-static method startservice(intent) type contextwrapper
is there way startservice in static method?
looks you've got reference context
class via context
variable (since using create intent intent intent = new intent(context, gpslocation.class);
), can start static context in following way:
context.startservice(intent)
Comments
Post a Comment