1
我的應用程序有一個功能,可以在屏幕中列出固定數量的產品(比如5)。具有固定的最大產品數量的清單產品
int max=5;
//when the next button is clicked
if(start<=items)
{
start=start+max;
}
//when the previous button is clicked
start=start-max;
for(int i=start;i<=start+max;i++)
{
//list products process
}
可以有3個或17,或者可以是26 products.But該算法被設計成使得它要經過5.Which的多說爲17產物負載20級的產品,其可以應用程序崩潰。我的問題是「有沒有辦法避免額外的產品加載」?