I have a camera layout. I need that to handle the flash icon. Just like in the normal in-built cameras, you click on the icon, the icon and the flash mode changes. The icon is in the action bar.
final ImageView flashicon=(ImageView)view.findViewById(R.id.flash_actionbar);
flashicon.setOnClickListener(new View.OnClickListener() {
Drawable cameraflashautoicon=getResources().getDrawable(R.drawable.cameraflashauto);
@Override
public void onClick(View v) {
if(flashicon.getDrawable().getConstantState().equals(R.drawable.cameraflashauto)){
flashicon.setImageDrawable(cameraflashautoicon);
}
if(flashicon.getDrawable().getConstantState().equals(R.drawable.cameraflashoff)){
}
if(flashicon.getDrawable().getConstantState().equals(R.drawable.cameraflashon)){
}
}
});
I read a few posts related to this, but couldn't figure out what to do. Please help. The way this question is proposed may not be ideal, so please let me know what other code or detail is needed.
I am using surface view and then calling the camera instance.