Ashwin Sundar

Greenhorn
+ Follow
since Jun 06, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ashwin Sundar

Hi everyone,

So right now I'm building an app on competitive Pokemon, and right now I am having issues getting specific background colors depending on the text views. The layout, essentially, will be the Pokemon name followed by the type; I want the type to be associated with a certain color. Grass will be green, Electric is yellow, etc. The idea is that the type will show up next to the Pokemon name.

I don't really know how to do it in XML, so what I did in the code was created an associative array for the types, as well as the colors. I mapped each type to a color, and tried setting the backgrounds, but no background color is showing up. Below is all relevant code:

PokemonAdapter.java





TypeBackgrounds.java



MapString.java






pokedex_text_view.xml




PokedexView.java

//this is the view class




colors.xml
10 years ago