平时在小米手机上都可以通过,然鹅在同事的OPPO手机上就挂了
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
在给 ListAdapter 传 context 的时候,为了防止内存泄漏,我调用的context.getApplicationContext()
,当点击了订单 item 的时候,打开订单详情页,在其他设备上都测试通过
public OrdersLvAdapter(Context context) {
this.context = context.getApplicationContext();
inflater = LayoutInflater.from(context);
}
...
Intent intent = new Intent(context, OrderDetailActivity.class);
intent.putExtra("order_id", orderId);
context.startActivity(intent);
然鹅在 oppo 手机上则需要用 activity 对象来 startActivity,没办法,只好换成 Activity 能正常开启activity
网友评论