as title says, how to make my ripple effect on ImageButton
(ripple effect assigned to this ImageButton) activated on backpressed()
without back to the previous activity
Asked
Active
Viewed 88 times
-4

Aditya Vyas-Lakhan
- 13,409
- 16
- 61
- 96

meeftah
- 95
- 1
- 1
- 13
-
1share some code you tried. – Janki Gadhiya May 03 '16 at 04:23
1 Answers
1
with a bit of logic you could achieve that easily. what i thought of is that you have a method lets call it doSomething();
boolean onBackpressed = false;
private void doSomthing() {
if(onBackpressed){
finish();
}else{
// do anything else that the button wants to do;
}
}
now onBackpressed()
you could do this
@Override public void onBackpressed() {
onBackpressed = true;
myImageButton.performClick(); // myImageButton.callOnClick()
}
P.S: that i didn't call super.onBackpressed();
so we can control the back press without existing the app.
of course your imageButton
click listener
calls doSomething()
method.

Kosh
- 6,140
- 3
- 36
- 67
-
is bot working, I still didn't see ripple effect activated on backpress button – meeftah May 03 '16 at 03:57
-