Skip to content

Instantly share code, notes, and snippets.

@mako34
Created September 13, 2013 02:43
Show Gist options
  • Save mako34/6546288 to your computer and use it in GitHub Desktop.
Save mako34/6546288 to your computer and use it in GitHub Desktop.
Android button listener for a fragment, note the return!
public class PhoneValidateView extends SherlockFragment{
private Button btnNewEmpresa;
private LinearLayout lLayoutFrgValidate;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
//get the layou8t
lLayoutFrgValidate=(LinearLayout) inflater.inflate(R.layout.activity_validate_phone, container, false);
btnNewEmpresa=(Button) lLayoutFrgValidate.findViewById(R.id.button_testeo);
btnNewEmpresa.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d("mensa", "sikas");
}
});
//ojo este jode!, devuelve nueva vista!
// return inflater.inflate(R.layout.activity_validate_phone, container, false);
return lLayoutFrgValidate;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment