Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Android provide many views for different use in the android app. ImageView is one of the views provided by Android to display image. We can add image on an ImageView from different sources.e.g.,
– adding an image from the drawable folder, you can find this folder in android project directory in android studio or eclipse. – adding an image from phone storage. – take a picture using the camera and set it on an ImageView. So, let us create a simple project to display an image on ImageView: 1. Create a new project->Project Name(MyApplication) 2. Add an activity “MainActivity.java” and a XML file “activity_main.xml”.
3. Create a method (setImage()) in MainActivity.java:
4. Here we are calling another activity using “startActivityForResult()” method. It returns the result on its completion. So, here is another method(onActivityResult()) associated with this. In this method, we will set the image in ImageView.
5. After doing this code we need to add permissions in AndroidManifest.xml:
Complete code is here:
MainActivty.java
activity_main.xml
AndroidManifest.xml:
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Vincenzo Carrano
Administrator, Segshop
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.