simple probelm in image access

Put your problem here if it does not fit any of the other categories.

simple probelm in image access

Postby soniya » Thu Feb 07, 2008 3:22 pm

i have image name in string for example

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. String S=strArr[1][2];
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


i want that image will be draw...how to get id of that image


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  R.drawable."S"
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
??????? i want get it id because after that it id store in int array

plz help me if anyone know about it???
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Top

Postby Jesmiatka » Thu Feb 07, 2008 3:35 pm

Hi,

I can tell you that the R class only contains the predefined strings , layouts, drawables etc.
For example (string): Every string name you see in the string.xml will get an id in pointed automatically in the R class.
For example (drawable): An image thats held in the drawable folder will get an id pointed automatically in the R class.

What value(s) are you holding in that String Array ? Is it an URI and where do you get it from?

Yours sincerely,
Mike Jesmiatka
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Postby soniya » Fri Feb 08, 2008 7:00 am

it get from text file....actually im prase text file and it get in String array....
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby soniya » Fri Feb 08, 2008 11:07 am

i have file name in string.......
i want get that file id in R.drawable class.....
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby Jesmiatka » Fri Feb 08, 2008 11:14 am

Hi,

I do not know for sure what you mean, but you should not edit the R class yourself. It will be generated.
If you want to use a drawable just place it in that directory and you will be able to call it's ID by using:
R.drawable.<name>

Again, I'm not sure what your intention or problem is so sorry if I give you useless information.
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Postby soniya » Fri Feb 08, 2008 2:23 pm

directory?????how to use :?:
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Top

Postby Jesmiatka » Fri Feb 08, 2008 2:37 pm

Hi,

just use windows for copying and pasting it in your project directory.
The directory to place it in is the following:
%project%/res/drawable/


Just paste the needed file there, be sure to refresh your project. The R file will now update himself and you will be able to call the image with. R.drawable.<name>

You can also paste the file in eclipse, same directory

Note:
You don't need the .jpg for calling the file. For example:
image.jpg will be called with R.drawable.image
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Postby plusminus » Fri Feb 08, 2008 2:41 pm

Hello soniya,

I saw you trying this :darrow: what does not work of course:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. R.drawable."S"
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


So this :darrow: my be of interest for you:
:arrow: :src: http://www.anddev.org/viewtopic.php?t=460

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby soniya » Fri Feb 08, 2008 3:30 pm

hi Jesmiatka and plusminus
thanks for reply...i will try it.....i have 1 more question is there

http://www.anddev.org/plz_help_if_anyone_know_it-t810.html


plz reply it's urgent................
soniya
Senior Developer
Senior Developer
 
Posts: 111
Joined: Mon Jan 14, 2008 1:52 pm
Location: india

Postby plusminus » Fri Feb 08, 2008 3:42 pm

Already answered there. :)
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 12 guests