How to implement the BackPressed function by OnLongClickListener

advertisements

This is onBackPressed function by onClickListener:

onback.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            onBackPressed();
        }
    });

Do you have any idea how to implement this by OnLongClickListener?


is that your mean?

onback.setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public void onLongClick(View v) {
            // TODO Auto-generated method stub
            onBackPressed();
            return false;
        }
    });

and import:

import android.view.View.OnLongClickListener;