how to make a Bitmap read as a route?

1
Hash_file_maps = new HashMap<String, String>();


    sliderLayout = (SliderLayout)findViewById(R.id.slider);

  for (int i=0;i<NombreImagen.length;i++)
   {
        Hash_file_maps.put(NombreImagen[i],imagenes[i]);

    }

for(String name : Hash_file_maps.keySet()){

        TextSliderView textSliderView = new TextSliderView(MainActivity.this);
        textSliderView
                .description(name)
                .image(Hash_file_maps.get(name))
                .image()

                .setScaleType(BaseSliderView.ScaleType.Fit)
                .setOnSliderClickListener(this);
        textSliderView.bundle(new Bundle());
        textSliderView.getBundle()
                .putString("extra",name);
        sliderLayout.addSlider(textSliderView);
    }

the .image () is asking me for a route but in my case I have BitMaps

    
asked by Uriel Balam 14.06.2017 в 19:14
source

1 answer

0

If you check the example , the image() method indicates that you need the int value of the resource in your program, to load the image. To load several images, a Hashmap is created where the name and id of the resource (s) are defined:

  HashMap<String,Integer> file_maps = new HashMap<String, Integer>();
        file_maps.put("Imagen Uriel",R.drawable.ic_launcher);
        file_maps.put("otra imagen",R.drawable.bigbang);

That way I would load the image (s) without problem:

 textSliderView
                .description(name)
                .image(file_maps.get(name))
                //.image() // * No necesaria.
                .setScaleType(BaseSliderView.ScaleType.Fit)
                .setOnSliderClickListener(this);

the second call to the .image() method that you are adding is unnecessary.

    
answered by 15.06.2017 в 01:18