Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old October 20th, 2011, 11:54 AM   #1 (permalink)
New Member
 
Join Date: Oct 2011
Location: Croatia
Posts: 6
 
Device(s): Xperia Arc S
Thanks: 1
Thanked 0 Times in 0 Posts
Default Get drawable name from image adapter?

Hello.

Im making an app in which the user selects an image and then gets redirected to a new screen in which the drawable name is displayed.

This is the code triggered when the user click an image:
Code:
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    Intent tabsIntent = new Intent();
    tabsIntent.setClassName("com.budisha.app", "com.budisha.app.TabClassActivity");
    tabsIntent.putExtra("pic_name", position);  //sends picture position
    startActivity(tabsIntent);
}
This sends the new activity the drawable position. But i need to get the drawable name.
Is there any way to do this? If yes, can you help me?

Sorry if I'm posting in the wrong section. Im new to this forum

Budisha is offline  
Reply With Quote
Sponsors
Old October 20th, 2011, 12:27 PM   #2 (permalink)
Member
 
Join Date: Aug 2010
Location: Norway
Posts: 308
 
Device(s): Samsung Galaxy Nexus
Thanks: 0
Thanked 52 Times in 51 Posts
Default

Code:
getResources().getResourceEntryName(R.string.app_name)
__________________
Android: Personal Storage, Lars Monsen Facts(Norwegian)
miXer is offline  
Reply With Quote
The Following User Says Thank You to miXer For This Useful Post:
Budisha (October 20th, 2011)
Old October 20th, 2011, 01:21 PM   #3 (permalink)
New Member
 
Join Date: Oct 2011
Location: Croatia
Posts: 6
 
Device(s): Xperia Arc S
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hello.
Thank you for the reply, but your post didnt help me.
Your code returned "app_name".
Bur your answer helped me to figure the solution.
This is my code:
Code:
getResources().getResourceEntryName(2130837508 + position)
2130837508 is the first picture.
Budisha is offline  
Reply With Quote
Reply

Bookmarks

Tags
adapter, android, drawable, image


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 08:08 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo