I'm new to android so please be tolerant to my lack of knowledge. My app is taking photos and saving them to Bitmap ArrayList, it works, i tested it, photos are displayable using ImageViews. Everything responsible for taking pictures looks like this:
//declaration
List<Bitmap> bmpList = new ArrayList<Bitmap>();
//onClick method of button for takin pics
public void takePic(View view){
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(requestCode == 0){
Bitmap image = (Bitmap) data.getExtras().get("data");
bmpList.add(image);
adapter.notifyDataSetChanged(); //more about my adapter and stuff below
}
}
I also have ListView, i'm extending ListActivity instead of just Activity becouse i found that working solution for dynamic String ArrayList in web. XML declaration of ListView: (with that method i don't have to declare it in the Java code)
<ListView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/photoButton"
android:id="@android:id/list">
</ListView>
I also use Bitmap adapter:
ArrayAdapter<Bitmap> adapter;
and then initialize it inside of onCreate method:
adapter = new ArrayAdapter<Bitmap>(this, R.layout.item, bmpList);
setListAdapter(adapter);
item.xml is the problem i have. I don't know how to create working ListView item that contains ImageView capable of displaying my Bitmap ArrayList elements preferably on the left. I tried adding just a ImageView but app crashes after saving the photo. My go-to functionality is having photo on the left, short description in the middle and ratingbar on the right, clicking on item takes user to another Activity where one can modify the description and rating, also displaying photo in full size. Some kind of hint will go a long way! Thank you in advance!