I have a fragment with touchable or clickable layout, i do not know why when i touch the fragment's layout and left my finger the funtion ""retrieveMQTTConnAssets()"" is caled twice "once when i touch the surface and keep touching and second time when i left my finger"
pease et meknow hw to avoid such behavior.
Update:
Actuay, I solved it now by instead of returning true, i returned false.but i do not understand it, why it is like this.
code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.w(TAG, "@onCreateView()");
View root = inflater.inflate(R.layout.eco_frag, container, false);
root.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
//Toast.makeText(getActivity().getApplicationContext(), "toched", Toast.LENGTH_SHORT).show();
retrieveMQTTConnAssets();
return true;
}
});
return root;
}