I'd like to have 4 images converted automatically.
(with auto-conversion for 2 seconds to android:flipInterval="2000" in xml)
Put four drawable images in the main_flyer_items.
I'm using it right out of the adapter (internal class).
Can I run the app, but I can't see the image.
No other classes or activities exist.
main_fliper_items = new ArrayList<Integer>();
for (int i = 0; i < 4; i++) {
main_fliper_items.add(getResources().getIdentifier("fliper" + i, "drawable", this.getPackageName()));
}
adapterViewFlipper = (AdapterViewFlipper) findViewById(R.id.main_filpper);
adapterViewFlipper.setAdapter(new MainFlipperAdapter(this));
adapterViewFlipper.startFlipping();
private class MainFlipperAdapter extends BaseAdapter {
Context context;
LayoutInflater inflater;
public MainFlipperAdapter(Context context) {
this.context = context;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return main_fliper_items.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null){
convertView = inflater.inflate(R.layout.main_fliper_item, parent, false);
}
ImageView item = (ImageView) convertView.findViewById(R.id.main_filper_item);
//Put 4 drawable images in main_flyer_items above
item.setImageResource(main_fliper_items.get(position));
return convertView;
}
}
I solved it. The image names are... xx1, xx2... The image was not printed because it started with 0 in the for statement
554 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
554 Who developed the "avformat-59.dll" that comes with FFmpeg?
553 Uncaught (inpromise) Error on Electron: An object could not be cloned
769 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.