Hi Dude,

     There is a simple method.

>From your activity you can directly call below code

getResources().getDrawable(R.drawable.rID)

it will return you the drawable object.

regards,
Faisal T

On Aug 1, 5:55 am, DroidDude <bhavy...@gmail.com> wrote:
> Hi,
>
> I am very new to Android Development and I have a doubt regarding
> Image Loading in ImageView from R.drawable.
>
> Just to brief What I am trying to accomplish is :Showing a ListView
> with ImageView and TextView using ViewWrapper pattern.
>
> I get the Text Value for TextView from one http service and I store
> all the values in String Array. I have implemented my own Adapter with
> my own implementation of getView().
>
> Now the issue:
>
> I have put all the images i want to show in res/drawable folder. now
> based on the value of text I want to pick that image from the folder
> and show it in the Imageview.
>
> For Example:
> if i get "aaa" as the value of TextView. I already have aaa.jpg in res/
> drawable folder and I want to set that image in ImageView.
>
> I don't know how to get the handle for aaa.jpg in androind.
>
> I have tried follwoing with no luck:
> ImageView.setImageResource() - But it takes the rID as argument which
> is of type int. I cant generate "R.drawable."+myVairable.
>
> ImageView.setImageDrawable(Drawable.createFromPath(PATHVariable))-But
> I don't know how to give the path to the image. I tried "./res/
> drawable/"+variable+".jpg"
>
> BitmapFactory takes the similar argument for all its method.
>
> I really don't want to write any Async Image Loader based on any
> server based URIs as I dont have any hosting server available.
>
> Kindly help.
>
> Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to