2016-10-27 3 views
0

サムスンデバイスためのEditTextのいずれかのonLongPress/onDoubleClickの場合、アプリはちょうどクラッシュします。ただし、他のデバイスで問題が発生しません。私はデバッグのために古いノート2を使用していて、フォーラムに投稿された同様の問題を参照しています(しかし削除されています)。もし誰かがソリューションを共有するならば大丈夫です。のEditText:クラッシュonLongPress、onDoubleCheckサムスンのデバイスでのみ

<EditText 
    android:id="@+id/vse_discountEv" 
    android:hint="@string/vse_boradcastHint"    
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical" 
    android:paddingTop="@dimen/pad_3dp" 
    android:paddingLeft="@dimen/pad_5dp" 
    android:paddingRight="@dimen/pad_0dp" 
    android:paddingBottom="@dimen/pad_5dp"    
    android:background="@color/transparent" 
    android:textColorHint="@color/gray_main_light" 
    android:textSize="@dimen/dim_20dp" 
    android:scrollbars="horizontal" /> 

Logcatメッセージ:

10-28 11:08:56.311: E/AndroidRuntime(22228): FATAL EXCEPTION: main 
10-28 11:08:56.311: E/AndroidRuntime(22228): Process: com.export, PID: 22228 
10-28 11:08:56.311: **E/AndroidRuntime(22228): java.lang.ArithmeticException: divide by zero** 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.widget.Editor.updateShowAsAction(Editor.java:6111) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.widget.Editor$SelectionActionModeCallback.onCreateActionMode(Editor.java:3314) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at com.android.internal.policy.impl.PhoneWindow$DecorView$ActionModeCallbackWrapper.onCreateActionMode(PhoneWindow.java:3020) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at com.android.internal.app.ActionBarImpl$ActionModeImpl.dispatchOnCreate(ActionBarImpl.java:1021) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at com.android.internal.app.ActionBarImpl.startActionMode(ActionBarImpl.java:550) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.app.Activity.onWindowStartingActionMode(Activity.java:5218) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionMode(PhoneWindow.java:2632) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionModeForChild(PhoneWindow.java:2619) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:675) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:675) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:675) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:675) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:675) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:675) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.View.startActionMode(View.java:4752) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.widget.Editor.startSelectionActionMode(Editor.java:1814) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.widget.Editor.performLongClick(Editor.java:1045) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.widget.TextView.performLongClick(TextView.java:10118) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.view.View$CheckForLongPress.run(View.java:19410) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.os.Handler.handleCallback(Handler.java:733) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.os.Handler.dispatchMessage(Handler.java:95) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.os.Looper.loop(Looper.java:146) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at android.app.ActivityThread.main(ActivityThread.java:5602) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at java.lang.reflect.Method.invokeNative(Native Method) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at java.lang.reflect.Method.invoke(Method.java:515) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
10-28 11:08:56.311: E/AndroidRuntime(22228): at dalvik.system.NativeStart.main(Native Method) 
+0

Logcatとは何ですか? –

+0

エラーを投稿するlogcatに何かありますか –

+0

logcatからmsgを更新しました。それは0で割ると言いました....しかし、edittext longpressは他のデバイスでうまく機能しています –

答えて

0

どのようにあなたのコード内でonLongPressonDoubleClickを処理したのか?

次のコードをもう一度試しましたサムスンデバイス(SM-A7009)は、残念ながら説明した問題を見つけることができませんでした。

GestureDetectorを使用して、onLongPressonDoubleClickというイベントを処理します。

EditText editText1 = new EditText(this); 
    editText1.setText(R.string.app_name); 
    final GestureDetectorCompat gestureDetectorCompat = new GestureDetectorCompat(this, 
      new GestureDetector.SimpleOnGestureListener() { 

       @Override 
       public boolean onDown(MotionEvent e) { 
        return true; 
       } 

       @Override 
       public void onLongPress(MotionEvent e) { 
        super.onLongPress(e); 
        Log.d(TAG, "onLongPress"); 
       } 

       @Override 
       public boolean onDoubleTap(MotionEvent e) { 
        Log.d(TAG, "onDoubleTap"); 
        return super.onDoubleTap(e); 
       } 
      }); 
    editText1.setOnTouchListener(new View.OnTouchListener() { 
     @Override 
     public boolean onTouch(View v, MotionEvent event) { 
      return gestureDetectorCompat.onTouchEvent(event); 
     } 
    }); 
    setContentView(editText1); 
+0

これは単なる編集文であり、特別なものはありません取り扱い。しかし、この編集テキストでは、ユーザが編集テキストからテキストをコピーするために長時間踏み込むので、長いプレゼンテーションが必要です。 Samsung Note2でコードを試しましたが、クラッシュすることはありませんが、もはや編集可能ではなく、onlongpressはテキスト/単語を強調表示しません。 –