PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 6, 2022

[FIXED] How To store image view id's in array and set image resource on specific image view element

 May 06, 2022     android, android-resources, image, imageview     No comments   

Issue

imgv is a array contain id's of image view

How do I store ImageView IDs in an array and set Image resource on a specific ImageView element?


Solution

You can't use setImageResource on int array this method must be used on ImageView object

Sets a drawable as the content of this ImageView.

More explanation in documentation ImageView

Simply you can do something like this

    int[] array = {R.drawable.imag_view_1,R.drawable.imag_view_3,R.drawable.imag_view_2};

    imageView.setImageResource(array[0]);


Answered By - MuhammadAliJr
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing