I have a ViewPager that uses fragments ... fragments contain only a framelayout with ImageView and a large TextView as the name right now .. each image fragment is loaded asynchronously ..
My problem is after the completion of the asynchronous task, I see that the image title changes with a new value. but ImageView shows an image that only loads for the first time.
onCreateView method
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
When my asynchronous loader loads information
@Override public void onLoadFinished(Loader<DImage> arg0, DImage arg1) { View v = getView(); ImageView im = (ImageView) v.findViewById(R.id.fragment_image); im.setImageBitmap(arg1.image); TextView tv = (TextView) v.findViewById(R.id.fragment_image_title); tv.setText(arg1.id + ""); }
The result obtained is different for all fragments. Also the textview text is displayed differently when I smooth the image. I tried to set the image bitmap to zero and then update using a new bitmap .. but it does not work. any clue where am i going wrong?
EDIT: adding an XML fragment
<ImageView android:id="@+id/fragment_image" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:keepScreenOn="true" /> <TextView android:id="@+id/fragment_image_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textSize="30dp" />
Kamal source share