set tit of image programmatically 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));

4
5
Frut 105 points

                                    imageView.setColorFilter(ContextCompat.getColor(context, R.color.COLOR_YOUR_COLOR), android.graphics.PorterDuff.Mode.SRC_IN);

4 (5 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
add image dynamically in android android java update image dynamically how to dynamically load an image in android change image dynamically in android studio android set dynamic image how to set image dynamically in android make dynamic image android set image dynamically in android android create dynamic images how to add a dynamic image android studio load image dynamically android android set image tint programmatically dynamically access image in android studio how to dynamically add images in android studio set image tint programmatically android android java change image dynamically how to change image dynamically in android show drawable image form programmatically android dynamic drawable android android imageview tint programmatically change tint programatically android set tint to image view programaticall android appcompatimageview tint programmatically how to change image resource by using setResource method in android image tint programmatically android setting tint of imageview programatically\ how to load an image from drawable in android imageview android set tint color programmatically set tint programmatically android imageview set drawable set tit of image programmatically android if we want to set dynamic image in image view so how can we fix it kotlin how to save add drawable image to imageview from a string variable kotlin how to get drawable image to display in imageView using its name how to save add drawable image to imageview from a string variable how to dynamically set image resource in kotlin change integer image resource to drawable api how to set drawable imageview android studio setimageresource darawble set string image in image resource set string image in imageresource setimageresource android drawable set image from drawable android imagevies.set drawable set drawable in imageview android set image resource dynamically set image from drawable in imageview android dynamically change image in imageview android imageview set image from drawable
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source