SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String imageName=getImageName();      
  2.   id = getResources().getIdentifier(imageName, "drawable", getPackageName());
  3.   drawable = res.getDrawable(id);
  4.   ImageView cant1= (ImageView)findViewById(R.id.myimage01);
  5.   cant1.setImageDrawable(drawable);
  6.   ImageView cant2= (ImageView)findViewById(R.id.myimage02);
  7.   cant2.setImageDrawable(drawable);
  8.   ImageView cant3= (ImageView)findViewById(R.id.myimage03);
  9.   cant3.setImageDrawable(drawable);
  10.   ImageView cant4= (ImageView)findViewById(R.id.myimage04);
  11.   cant4.setImageDrawable(drawable);
  12.   ImageView cant5= (ImageView)findViewById(R.id.myimage05);
  13.   cant5.setImageDrawable(drawable);
  14.   ImageView cant6= (ImageView)findViewById(R.id.myimage06);
  15.   cant6.setImageDrawable(drawable);
  16.   ImageView cant7= (ImageView)findViewById(R.id.myimage07);
  17.   cant7.setImageDrawable(drawable);
  18.   ImageView cant8= (ImageView)findViewById(R.id.myimage08);
  19.   cant8.setImageDrawable(drawable);
  20.   ImageView cant9= (ImageView)findViewById(R.id.myimage09);
  21.   cant9.setImageDrawable(drawable);
  22.   ImageView cant10= (ImageView)findViewById(R.id.myimage010);
  23.   cant10.setImageDrawable(drawable);
  24.    
  25. String cad;
  26. for(int i=0;i<10;i++){
  27.       cad="myimage0";
  28.       String cat= Integer.toString(i);
  29.       cad=cad.concat(cat);
  30.       ImageView cant1= (ImageView)findViewById(R.id.cad);
  31.       cant1.setImageDrawable(drawable);
  32.   }
  33.    
  34. ImageView cant1= (ImageView)findViewById(R.id.***cad***);
  35.    
  36. int idResource = getResources().getIdentifier(cad, "id", getPackageName());
  37. ImageView cant1= (ImageView)findViewById(idResource);
  38.    
  39. getResources().getIdentifier(resName, "id", getPackageName());
  40.    
  41. String cad;
  42. for(int i=0;i<10;i++){
  43.       cad="myimage0";
  44.       String cat= Integer.toString(i);
  45.       cad=cad.concat(cat);
  46.       int id = getResources().getIdentifier(cad, "id", getPackageName());
  47.       ImageView cant1= (ImageView)findViewById(id);
  48.       cant1.setImageDrawable(drawable);
  49.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top