且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android,通过不同的活动在缓存中保存和加载位图

更新时间:2023-12-01 22:49:46

只需检查您的代码:

ImageView viewBitmap = (ImageView) findViewById(R.id.icon2);
viewBitmap.setImageBitmap(bitmap);
setContentView(R.layout.open_pic_layout);

您已在设置内容视图之前编写了findViewById().是错的.

You have written findViewById() before setting Content View. Its wrong.

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.open_pic_layout);

  // do your operations here
  }