Intent intent = getIntent();
if (intent != null && intent.hasExtra("QUANTITY")) {
int quantity = intent.getIntExtra("QUANTITY", 0);
if (quantity >= 0 && quantity < adapter.getItemCount()) {
viewPager.post(() -> viewPager.setCurrentItem(quantity, false));
} else {
Log.w(TAG, "Received invalid QUANTITY: " + quantity);
Toast.makeText(this, "Invalid quantity received", Toast.LENGTH_SHORT).show();
}
}
05-31
1032
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-16
761
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)