コード例 #1
0
 private void setSelection() {
   if (DBG) {
     Log.d(LOG_TAG, "--- onSelect:" + mCurStart + "," + mCurEnd);
   }
   if (mCurStart >= 0
       && mCurStart <= mEST.getText().length()
       && mCurEnd >= 0
       && mCurEnd <= mEST.getText().length()) {
     if (mCurStart < mCurEnd) {
       mEST.setSelection(mCurStart, mCurEnd);
     } else {
       mEST.setSelection(mCurEnd, mCurStart);
     }
     mState = STATE_SELECTED;
   } else {
     Log.e(
         LOG_TAG,
         "Select is on, but cursor positions are illigal.:"
             + mEST.getText().length()
             + ","
             + mCurStart
             + ","
             + mCurEnd);
   }
 }
コード例 #2
0
 private void unsetSelect() {
   if (DBG) {
     Log.d(LOG_TAG, "--- offSelect");
   }
   int currpos = mEST.getSelectionStart();
   mEST.setSelection(currpos, currpos);
   mState = STATE_SELECT_OFF;
 }