小编use*_*952的帖子

如果布尔表达式增加int内部

我想了解如何在每个循环迭代的if(布尔表达式)内增加int x这
怎么可能?它是如何工作的?

  public class MethodsTest {

 public static void main(String[] args) {
    int x= 0;

    for (int z = 0; z < 5; z++) 
    {

        if(x++ > 2){

        }

        System.out.println(x);
    }

}
 }
Run Code Online (Sandbox Code Playgroud)

输出将是
1
2
3
4
5

java

2
推荐指数
1
解决办法
7282
查看次数

使用LruCache在内存中存储位图

我一直在尝试在我的应用程序中实现LruCache,但我很难连接点和在不同组件之间传递位图.

我想知道如何在我的应用程序中集成LruCache.我也希望了解实施LruCache的过程,以便更多细节

第一个类是AsyncTask Image Loader,第二个类是我的自定义适配器

的AsyncTask

 public class GetImagesBitmap extends AsyncTask<ImageView, Void, Bitmap>{
    InputStream inputStream;
    ImageView imageView = null;
    String path;




    @Override
    protected Bitmap doInBackground(ImageView... imageViews) {
        this.imageView = imageViews[0];
        return download_Image((String)imageView.getTag());
    }

    @Override
    protected void onPostExecute(Bitmap result) {

        imageView.setImageBitmap(result);
    }

    private Bitmap download_Image(String url) {


        final AndroidHttpClient client = AndroidHttpClient.newInstance("Android");
        HttpGet httpGet = new HttpGet(url);
        try {
            HttpResponse httpResponse = client.execute(httpGet);
            final int statusCode = httpResponse.getStatusLine().getStatusCode();
            if (statusCode != HttpStatus.SC_OK) {
                Log.w("ImageDownloader", "Error " + statusCode
                        + " while …
Run Code Online (Sandbox Code Playgroud)

android memory-management android-lru-cache

1
推荐指数
1
解决办法
6515
查看次数