我想將數(shù)據(jù)庫中存儲的圖像添加到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);}
使用ViewFlipper以滑動視圖顯示數(shù)據(jù)庫中的圖像
慕田峪7331174
2023-08-04 14:43:38