【发布时间】:2014-05-07 11:34:23
【问题描述】:
我读过很多这样的问题,但似乎没有一个能解决我的问题。
问题出在:
AlertScreen ad = new AlertScreen(SensorListenerService.this);
在我的服务类中:
public class SensorListener extends Service implements SensorEventListener {
public int onStartCommand(Intent intent, int flags, int startId) {
startForeground(Process.myPid(), new Notification());
AlertScreen ad = new AlertScreen(SensorListener.this); //problem
ad.show();
return START_STICKY;
}
...
它调用我的 AlertScreen 类:
public class AlertScreen extends AlertDialog {
public AlertScreen(Context context) {
super(context);
}
...
LogCat 有什么要说的:
谁能解释一下这个问题?
【问题讨论】:
-
在您的服务的
onCreate()上试试这个AlertScreen ad = new AlertScreen(this);。 -
@SimplePlan 不,同样的故事。
-
我的回答成功了吗?
标签: android android-alertdialog