I am coding for an app in Android and am facing the following problem.
I have to override an inbuilt function Fragment getItem(int position)
to return the Bitmap of an image, but as the image is quite large it takes lots of time to load. So, the UI is a bit slow in responding.
To resolve this i think it can be resolved like in the following code. It basically returns a blank image immediately and when the real image is loaded it returns the proper image.
@Override
public Fragment getItem(final int position) {
pid = fork(); //NOT POSSIBLE / ERROR
if (!pid)
return (code for empty image);
return new ScreenSlidePageFragment(files[position].getAbsolutePath(), width, height);
}
But, I do not know of a function similar to fork()
in Java.
Can you please help me out with this issue, Thanks