Avoid mysterious crash
This commit is contained in:
1 parent
95f2d46420
commit
44026f0ccc
1 file changed
+9
-1
@@ -22,6 +22,7 @@ import android.support.v7.widget.AppCompatEditText;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
|
||||
public class SearchEditText extends AppCompatEditText {
|
||||
|
||||
@@ -76,7 +77,14 @@ public class SearchEditText extends AppCompatEditText {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP && mListener != null) {
|
||||
mListener.onClick();
|
||||
}
|
||||
return super.onTouchEvent(event);
|
||||
try {
|
||||
return super.onTouchEvent(event);
|
||||
} catch (Throwable t) {
|
||||
// Some devices crash here.
|
||||
// I don't why.
|
||||
ExceptionUtils.throwIfFatal(t);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public interface SearchEditTextListener {
|
||||
|
||||
Reference in new issue
Block a user