How to change toolbar to long click of a ListView

1

I'm a beginner on Android programming and would like to ask a question. I have a ListView that is connected to a SQLite database. My question is: how could I make it so that when the user gives a long click on an item in this list a new Toolbar appears?

For an example, see the prints.

    
asked by anonymous 17.04.2018 / 06:48

1 answer

0

Try this:

final GestureDetector detetor = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
    public void onLongPress(MotionEvent e) {
        Log.e("", "Clique Longo Detetado");
        //Adicionas a tua ToolBar aqui
    }
});

public boolean onTouchEvent(MotionEvent event) {
    return detetor.onTouchEvent(event);
};
    
17.04.2018 / 16:38