【发布时间】:2012-09-10 15:54:47
【问题描述】:
使用 android 下载中提供的示例应用程序,我想在 onCreate() 方法中使用 api.disableBumping() 来添加广播接收器,但禁用bumping,直至另行通知。应用程序总是在我身上崩溃。
任何指针?
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
bindService(new Intent(IBumpAPI.class.getName()),
connection, Context.BIND_AUTO_CREATE);
IntentFilter filter = new IntentFilter();
filter.addAction(BumpAPIIntents.CHANNEL_CONFIRMED);
filter.addAction(BumpAPIIntents.DATA_RECEIVED);
filter.addAction(BumpAPIIntents.NOT_MATCHED);
filter.addAction(BumpAPIIntents.MATCHED);
filter.addAction(BumpAPIIntents.CONNECTED);
registerReceiver(receiver, filter);
try {
api.disableBumping();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
调试信息
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1816
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1837
ActivityThread.access$1500(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 132
ActivityThread$H.handleMessage(Message) line: 1033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 143
ActivityThread.main(String[]) line: 4196
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 839
ZygoteInit.main(String[]) line: 597
NativeStart.main(String[]) line: not available [native method]
【问题讨论】:
-
允许崩溃在 Eclipse 中继续,然后查看 LogCat 以获取引发原始异常的代码的实际堆栈跟踪。