0
Guys I have a problem when I need to set my variable in View Page.
I have an Activity that searches the images inside the App and arrow in an Array String, until then it is all correct, I use the code below.
ContextWrapper cw = new ContextWrapper(getApplicationContext());
// path to data/data/yourapp/app_data/imageDir
new_folder = cw.getDir(pasta, Context.MODE_PRIVATE);
if (!new_folder.exists()){
new_folder.mkdir();
}
// verifica a pasta se tem arquivo //
files = new_folder.listFiles();
if ((files.length > 0)) {
String[] fileArray = new String[files.length];
int[] filesResource = new int[files.length];
for (int i = 0; i < files.length; ++i) {
fileArray[i] = files[i].getAbsolutePath();
}
}
Already in my class
public class CustomSwipeAdpter extends PagerAdapter {
I made an example that I saw in several tutorials that this class already has its methods ready... where I have to use an Integer Array, which searches only from drawable. thus:
private int[] image_resources = {R.drawable.image01, R.drawable.image02, R.drawable.image03};
What I really need to do is upload all the images that are inside the App to these variable image_resources, i have been able to do so far is to load the path of the images in an array of strings, already tried to convert the variable Filearray in Integer Array but of error.
If anyone has a solution I thank you... or if you have another example (tutorial, code) already help. Thanks...
Where will be used yours
array
image_resources
?– Igor Mello
will be used here 'imageView.setImageBitmap( decodeSampledBitmapFromResource(Resource, image_resources[position], // here is the problem 1080, 2560));' Before I was using Bitmapfactory.decodeFile but was giving problem...if I had any images with high resolution of the memory burst then I saw this method of the Android site that renders the image. I took this site (http://developer.android.com/intl/pt-br/training/displaying-bitmaps/load-bitmap.html).
– Fabricio Aguiar