0

Let me explain: I need to show the name of any building block either it is imagebutton, edittext in my textview field depending upon which of above written will be hover over by the user. So that my textview could behave like some dynamic display plate.

Any help will highly be appreciated.

mrana..

mrana
  • 67
  • 2
  • 12

2 Answers2

2

So something that you can do. Since there it no "setText" for imageviews, you can do something like

String name = "imageview";
imageView.setTag(name);

Then in your onFocusedChangedListener call the following method

void displayInTextView(View selectedView) {
    String viewName = (String) selectedView.getTag();
    mDisplayText.setText(viewName);
}
Frank Sposaro
  • 8,511
  • 4
  • 43
  • 64
1

Since this is a touch device, "hovering" will not be possible. One solution is to show the name on when long-press. See this solution https://stackoverflow.com/a/4433441/1227692

EDI: Thanks Frank and mrana for pointing out. I agree and take back my comment.

Community
  • 1
  • 1
Rajesh Kolappakam
  • 2,095
  • 14
  • 12
  • Thanks not 100% true. They don't call it hovering, they call it onFocusChangedListener(); This is what happened when you tried to navigate a page with the G1 trackball. This also happens if you have some accessibility options enable on Android as well. It let's the user touch the views and explore them before double clicking them inorder to actually activate them. – Frank Sposaro Feb 23 '12 at 07:43
  • Thanks @Rajesh but this not what i'm looking for. – mrana Feb 23 '12 at 07:55
  • Let me clear once again: let us take an example in simple website world, where if there is any hyperlink and you just move the cursor over there,you could see the link at the bottom of page. This function helps user to know where link would navigate him/her with out even clicking and going there(the target page). – mrana Feb 23 '12 at 08:00
  • @Rajesh Kr Reddy What do you mean by hovering is not possible? There are so may android devices with trackball/pad. If hovering is not possible then why would the onFocusChangeListener() method is there in the SDK? I wanna downvote this answer but don't have sufficient previliges. – mrana Feb 23 '12 at 08:09