how to set imageview src?

I have an image view and a string src. I want to set the imageview source to the string src that I have, but am unable to do so beacuse the method expects an int:


Since this method takes an int how can I accomplish my goal of using a string?

  • How can an error message be set for the Spinner in Android?
  • Android - change flavor version name based on build type
  • ScrollView .scrollTo not working? Saving ScrollView position on rotation
  • How do I programmatically change the ImageButton src target when a condition is met?
  • PublisherAdView.loadAd() throwing SecurityException - getTasks() requires android.permission.GET_TASKS
  • Passing data between a fragment and its container activity
  • Related posts:

    This Activity already has an action bar supplied by the window decor
    Could not find class XXX referenced from method XXX.<YYY>
    Error: Class not found when unmarshalling: com.facebook.login.Login Client Request
    Where are the additional command line options in Android Studio version 1.5.1 for the emulator
    JDK 7 with Android SDK R13 in windows 7
    How to handle back button using view pager?
  • Paste text on Android Emulator
  • In an Android gradle build, change contents of strings.xml during build
  • Difference between an AppCompat view and a normal Android view
  • Gradle won't exclude a module as requested
  • Android get the Intent when implementing RecognitionListener
  • NullPointerException when showing a ViewPager a second time
  • 2 Solutions collect form web for “how to set imageview src?”

    Each image has a resource-number, which is an integer. Pass this number to “setImageResource” and you should be ok.

    Check this link for further information:



    To set image cource in imageview you can use any of the following ways. First confirm your image is present in which format.

    If you have image in the form of bitmap then use


    If you have image in the form of drawable then use


    If you have image in your resource example if image is present in drawable folder then use


    If you have path of image then use

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.