I have a very specific component to realize. I don’t really know how to do it.
The component is a segmented bar with a cursor that can select any segment. A segment selection should update the number of segment in the bar. A segment could have two “state” which is represented with 2 differents graphics.
IE : 
This may sound like a rating Bar but i really don’t know how to proceed (new with java and android).
Should i use Rating Bar and just change the stars by segments ?
Should i extend RatingBar (how ?) ?
Any help will be appreciated
Looks like you’re going to have to write your own view. Don’t worry – it’s not so difficult (I did my first one without any sweat after 2 days of doing Android). Basically you have a class which extends
Viewand you override theonDrawfunction which draws directly to the suppliedCanvas. Make sure you override theonMeasurefunction too or your view will have no height!Have a look at the android page on Building Custom Components – a quick google or stack overflow search will give you many hints as to how to proceed too.
Once you work out how to write a custom view (start with a small prototype) then you just need the logic of how this specific controller works. I’d probably have a collection to hold each of your segments, with each item being a class representing your data. In your
onDrawthen you just have to process the collection and draw to the screen.To get your touch to zoom, override the
onTouchEventmethod, which will give you aMotionEventobject which you can callgetX()andgetY()on to return the coordinates of where the user touched your view – from there you can work out what segment the user touched and process the zoom.Let me know if you need any more help.