私の目標: 多くの画像をダウンロードし、ユーザーが無限にスクロールできるようにします。
私の問題:ユーザーがスクロールするときにRAMを節約するために、画像を効率的に設定および設定解除するのに問題があります。私はアンドロイドが初めてなので、私がやっているよりもはるかに良い方法があると確信しています。
私の現在の方法:これは単なる概要です
//I have a listener setup for the scroll
onScrollChanged(ScrollViewExt scrollView, int x, int y, int oldx, int oldy){
//if the user has scrolled 1000 pix and there is currently no other updating thread running
if(((y%1000==0)||(y%1000>990))&&!updating){
updating=true;
AsyncTask<String, Void, Void> update = new UpdateViews().execute(y+"");
}
}
//updateviews essentially iterates though all my views and calls a method in each one that returns getLocationOnScreen().
// This in turn is used to determine if the view is far away enough from the scroll to have its image removed or has come back to the area and is added to an appropriate array-list as to be altered later on the UI thread
//everything is saved to a array-list and the views are updated on the onPostExecute() because they have to be done on the main thread
今、私が書いたものにはいくつかの問題があることを知っています. これを効率的に行う方法についてのアイデアを探しています。