Reputation: 1800
How to get the text color of a gridview, in my app i have used black, white and red color to differentiate the text, now i need to get the color of a text in onclick, Give me some idea to get the solution.
Thanks.
Upvotes: 1
Views: 1090
Reputation: 2299
This will solve your problem:
gridViewLocation=(GridView) findViewById(R.id.gridViewLocation);
Now set adapter:
gridViewLocation.setAdapter(new GridViewAdapter(this, MOBILE_OS));
gridViewLocation.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
TextView textView=(TextView) v.findViewById(R.id.grid_item_label);
textView.getCurrentTextColor();
}
});
Upvotes: 0
Reputation: 1726
You can use this in OnItemClick
textView.getCurrentTextColor();
Upvotes: 0
Reputation: 17401
set onItemClickListener to:
gridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int arg2,
long arg3) {
TextView tv = (TextView) view;
int color=tv.getCurrentTextColor();
}
});
Upvotes: 1