我有一个扩展应用程序的类,从那里开始,在检测抖动时,它应该打开一个活动。但是,对于特定的活动,它会关闭应用程序。日志中没有崩溃或错误,这使得调试变得非常困难......
启动活动的代码如下:
int currentViewingMemberId = CommonFunctions.get_CURRENT_VIEWING_MEMBER_ID(this);
Bitmap b = takeScreenshot();
Intent contactAndReportIntent = ReportIssueActivity.getIntentForActivity(getApplicationContext(), true, null, b, currentViewingMemberId);
contactAndReportIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(contactAndReportIntent);
mSensorManager.unregisterListener(this);
hasAccelerometerSensorBeenRegistered = false;
getIntentForActivity() 方法如下:
public static Intent getIntentForActivity(Context context, boolean isFromShake, String helpTip, Bitmap screenshot, int currentViewingMemberId) {
Intent intent = new Intent(context, ReportIssueActivity.class);
intent.putExtra(FROM_SHAKE, isFromShake);
if (helpTip == null) {
helpTip = "";
}
if (screenshot != null) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
screenshot.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
intent.putExtra(SCREENSHOT_IMAGE, byteArray);
}
intent.putExtra(HELP_TIP, helpTip);
intent.putExtra(CURRENT_VIEWING_MEMBER_ID, currentViewingMemberId);
return intent;
}
takeScreenshot() 捕获当前窗口并成功返回一个位图,但甚至没有调用 Activity onCreate()。
任何想法都会有所帮助,谢谢!:)