I'm working with fragments, and I made a new fragment in which I need to use a button that turns on the phone's flashlight. The problem is that when I try to declare it, it gives me an error, (I still get an error in @Override):
package com.example.oscarsierra.bladenotes;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class LinternaFragment extends Fragment {
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener(){
@Override
public void OnClick(View v){
}
});
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_linterna, container, false);
}
}