I want to create an app for Android devices that will have 2 buttons, one button for "ON" and the other for "OFF". I have searched the net for an example and I have seen many examples, but they were very bad organized (for me). what I have created so far is the layout with the buttons and the code of the main activity is:
package com.simple.flashlight;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Camera;
import android.hardware.Camera.Parameters;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
public class Main extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_menue);
Button turnOnButtOn = (Button) findViewById (R.id.button1);
Button turnOnButtOff = (Button) findViewById (R.id.button2);
turnOnButtOn.setOnClickListener(new Button.OnClickListener(){
public void onClick(View cameraButton){
}
});
}
}
now I want to do something like this (pseud code):
turnOnButtOn.setOnClickListener(new Button.OnClickListener(){
public void onClick(View cameraButton){
turnOnTheFlahLight
}
});
turnOnButtOn.setOnClickListener(new Button.OnClickListener(){
public void onClick(View cameraButton){
turnOffTheFlahLight
}
});
If there any full reference (I am new to android) it would be nice. Thanks