i have app has camera preview view. i've added button overlays framelayout camera preview inside. before added button camera preview worked fine; however, after addition of button, camera preview not display.
here xml layout using:
> </framelayout> <linearlayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom" > <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="freeze" android:id="@+id/buttonfreeze" android:background="@null" android:clickable="true" /> </linearlayout>
my onclick listener , corresponding methods:
public void onclick(view v) { if(v == buttonfreeze) { if(buttonfreeze.gettext().equals("freeze")) { mirrorview.freezepreview(); buttonfreeze.settext("unfreeze"); } else { mirrorview.unfreezepreview(); buttonfreeze.settext("freeze"); } } } public void freezepreview() { mcamera.stoppreview(); } public void unfreezepreview() { mcamera.startpreview(); }
is addition of button causing this? or else?
replace
if(v == buttonfreeze) {
with
if(v.getid() == r.id.buttonfreeze) {
Comments
Post a Comment