我想将数据库中存储的图像添加到ViewFlipper的图像视图中。但是当我添加这些图像时,我遇到了一些错误。请帮助我解决该问题,或者让我知道是否有其他解决方案。这是我的代码:MainActivity.javapublic class MainActivity extends AppCompatActivity {DatabaseHelper myDb;EditText editImagename;Button btnAddData;Button btnview;ImageView imgview;ViewFlipper viewflips;private static int RESULT_LOAD_IMAGE = 1;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); editImagename = findViewById(R.id.image_name); btnAddData = findViewById(R.id.addbtn); btnview = findViewById(R.id.getbtn); imgview = new ImageView(this); viewflips = findViewById(R.id.viewflip); viewAll(); TextView txt = findViewById(R.id.text); txt.setSelected(true); Button buttonLoadImage = findViewById(R.id.btn1); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(Intent.ACTION_PICK,Uri.parse("content://media/internal/images/media")); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); myDb = new DatabaseHelper(this);}
添加回答
举报
0/150
提交
取消