I am using RecyclerView on Android and I am having image problems.
I would like to display a list of images in a specific folder with their path names.
So this is mine row.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/my_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="test" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
</LinearLayout>
In my adapter, I use this code to set the image of a string:
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.mTextView.setText(mDataset[position]);
holder.mImageView.setImageURI(Uri.parse("file://" + mMediaStorageDir.getPath() + "/" + mDataset[position]));
}
Images load fine, but when I scroll down, the whole application becomes very slow.
This does not happen if instead I download a small portable code. Is it because the pictures are too big?
user1361491
source
share