onClickListener does not work in fragment
I think problem is here in your code
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
.....
....
//problem is here below line
return inflater.inflate(R.layout.input_fgmt, container, false);
}
return your already inflated view
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View inputFragmentView = inflater.inflate(R.layout.input_fgmt, container, false);
.....
....
return inputFragmentView;
}
change
return inflater.inflate(R.layout.input_fgmt, container, false);
to
return InputFragmentView ;
Also change with this:
translate_button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
Log.d("Test", "onClickListener ist gestartet");
Toast.makeText(getActivity().getApplicationContext(), "Test", Toast.LENGTH_LONG).show();
saveInString();
}
});
and import as a import android.view.View;