Sorry - what I'm saying is no - setting background has no effect
On Oct 22, 9:18 pm, "droidin.net" <bost...@gmail.com> wrote:
> "Are you actually getting control in your onClick()? If yes, then
> calling
> setBackgroundColor() should work fine. "
>
> Yes, I can setup a breakpoint and see how I'm executing this line. I
> think the problem may be that in two lines after that I'm doing
> startActivity(Intent) so maybe Android thinks - Ah - hell with this,
> I'm not going to repaint existing Activity since the new one is coming
> up. THe problem is - new Activity takes its sweet time since it's
> making a network call, meanwhile user is left without any visual clue
> if that click did really occur.
>
> Here's a snippet
>
> body.setOnClickListener(new OnClickListener() {
> @Override
> public void onClick(final View v) {
> final Object u = v.findViewById(R.id.e).getTag();
> if (u != null) {
> v.setBackgroundColor(R.color.item_highlight);
> final Uri uri = Uri.parse(u.toString());
> final Intent i = new Intent("summary", uri,
> SearchResultsView.this, SearchSummaryView.class);
> startActivity(i);
> } else {
> Toast.makeText(SearchResultsView.this, "Unable
> to display details for this listing",
> Toast.LENGTH_LONG).show();
> }
> }
> });
>
> On Oct 22, 2:50 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > droidin.net wrote:
> > > So to summarize my question - how do I change background of the child
> > > element in the list item if I assign custom onClick handler to it? Any
> > > hints will be greatly appreciated
>
> > Are you actually getting control in your onClick()? If yes, then calling
> > setBackgroundColor() should work fine.
>
> > Here is an example project that changes the background of View in a row
> > based upon list selection (D-pad/trackball):
>
> >http://github.com/commonsguy/cw-advandroid/tree/master/ListView/Selec...
>
> > This differs from your scenario only by the trigger mechanism (onClick()
> > versus an item selected listener).
>
> > --
> > Mark Murphy (a Commons
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android App Developer Books:http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---