Win a copy of Fixing your Scrum this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

how to set a drawable to a view

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i have an arraylist of object and one element of the onjects is a drawable and im need to return this object as an imageview but wont alow me to (cast) it to view i havint coedd in months as busy working anyone know how i could do this

 

any help would be great thanks
 
Master Rancher
Posts: 4454
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One problem with the code is the return statement inside of the loop at line 15.  It will always return the first item.  Should there be an if test to select which one to return,

Can you copy the full text of the error message and paste it here so we can see what it is and what statement has the error?
 
john bean
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its a compile time error and it should return an image every time from the array of objects thanks for reply
 
Norm Radder
Master Rancher
Posts: 4454
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

its a compile time error


Please copy the full text of the error message and paste it here.  It should show what statement the error was on

and it should return an image every time


Why have a loop if the code always returns the first element in the array?
 
john bean
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
code generates object from this class and puts them into an arraylist


the for loop then gos through the arraylist pulling out the icons and put them into a scrollable gridview but the icons are drawables i need to convert them to imageviews

the error is


thanks again for reply
 
john bean
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
k so im an idiot this is how



knew it had to be simple
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic