By dennisAC
on Wed, 02/27/2013 - 09:52
hi, i need help here, i want to make a togglebutton overlay my camera, i want that togglebutton will control my text view to visible and invisible..
i have create the inflater and reference it to my overlay.xml and create my toggle button here, in initApplication() method:
LayoutInflater inflater = getLayoutInflater(); mOverlayView = inflater.inflate(R.layout.overlay, null); toggleButton1 = (ToggleButton) mOverlayView.findViewById(R.id.toggleButton1);
i have add these codes on my Runnable()
addContentView(mOverlayView, new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
but i dont know how to use toggle button to make my textview visible and invisible, and where i should write it... can anyone give help for me :)
toggle button to show textview overlay the camera
Hi, have you checkd this guide:
http://developer.android.com/guide/topics/ui/controls/togglebutton.html
it provides a code snippet to intercept toggle events on the toggle button.
toggle button to show textview overlay the camera
thx for the reference link, i'm sorry, i should search it first on google... but um..
toggle button to show textview overlay the camera
Hi, if you use a ToggleButton (instead of a standard Button), you cannot use the OnClickListener, but you should rather use the OnCheckedChangeListener, like in this code:
toggle button to show textview overlay the camera
wow, you reply my post so fast.. thx :D
thank you for the correction, i changed my code, now my Debug.Log appears.. but i have questions here:
toggle button to show textview overlay the camera
Hi, you probably do not want to inflate and add the overlay in the handleMessage() method; the creation and setup of the layout and the toggleButton should be done only once, during the initialization phase
If it does not work, you may want to put some extra logs and debug a bit more.