通过意图传递数据时会显示错误。
appAbout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Activity activity = (Activity) context;
Intent intent = new Intent(context, AppActivity.class);
intent.putExtra("app_name", appInfo.getName());
intent.putExtra("app_apk", appInfo.getAPK());
intent.putExtra("app_version", appInfo.getVersion());
intent.putExtra("app_source", appInfo.getSource());
intent.putExtra("app_data", appInfo.getData());
Bitmap bitmap = ((BitmapDrawable) appInfo.getIcon()).getBitmap();
intent.putExtra("app_icon", bitmap);
intent.putExtra("app_isSystem", appInfo.isSystem());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
String transitionName = context.getResources().getString(R.string.transition_app_icon);
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(activity, appIcon, transitionName);
context.startActivity(intent, transitionActivityOptions.toBundle());
} else {
context.startActivity(intent);
activity.overridePendingTransition(R.anim.slide_in_right, R.anim.fade_back);
}
}
});
数据未通过。记录猫,Null pointer exception
但我不知道为什么。