Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to set image dynamically in android

String fnm = "cat"; //  this is image file name
String PACKAGE_NAME = getApplicationContext().getPackageName();
int imgId = getResources().getIdentifier(PACKAGE_NAME+":drawable/"+fnm , null, null);
System.out.println("IMG ID :: "+imgId);
System.out.println("PACKAGE_NAME :: "+PACKAGE_NAME);
//    Bitmap bitmap = BitmapFactory.decodeResource(getResources(),imgId);
your_image_view.setImageBitmap(BitmapFactory.decodeResource(getResources(),imgId));
Comment

android java update image dynamically

ImageView image = (ImageView) findViewById(R.id.test_image);
    image.setImageResource(R.drawable.xxx);
Comment

PREVIOUS NEXT
Code Example
Java :: how to get column and row numbers in java 
Java :: concatenar java 
Java :: java web.xml 
Java :: java get difference days without weekends 
Java :: how to open a folder in java swing project 
Java :: what does import com.sun.glass do 
Java :: drools spring boot 
Java :: java unused import statement 
Java :: java Tiempo transcurrido entre fechas y horas 
Java :: Program to read base and power and then calculate result of that expression using recursion in java 
Java :: jdbc code 
Java :: how to install java jdk 8 on ubuntu 20.04 for spark 
Java :: java k jump 
Java :: null pointer exception during registering user to the firebase 
Java :: fix intellij resetting the java version everytime you add a dependency 
Java :: arraylist character agregar elementos en java 
Java :: hollow rectangle pattern in java 
Java :: Java Insert Elements to TreeSet 
Java :: circular roation continous in android 
Java :: spring security specific url for specific account 
Java :: pioneer meaning 
Java :: java hashset api 
Java :: rgb code from java color 
Java :: quick way to get charAt 
Java :: interface in java 
Java :: Java if...else...if Statement 
Java :: java constructor 
Java :: java to c++ converter 
Java :: number of matches regex java 
Java :: ArrayIndexOutOfBoundsException 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =