本文整理匯總了Java中android.widget.MultiAutoCompleteTextView.getSelectionStart方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiAutoCompleteTextView.getSelectionStart方法的具體用法?Java MultiAutoCompleteTextView.getSelectionStart怎麽用?Java MultiAutoCompleteTextView.getSelectionStart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.MultiAutoCompleteTextView
的用法示例。
在下文中一共展示了MultiAutoCompleteTextView.getSelectionStart方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onActivityResult
import android.widget.MultiAutoCompleteTextView; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case Constants.REQUEST_CODE_USER_SELECTOR:
if (resultCode == Constants.RESULT_CODE_SUCCESS) {
List<User> userList = (List<User>)data.getSerializableExtra("LIST_USER");
if (ListUtil.isEmpty(userList)) {
userList = new ArrayList<User>();
}
MultiAutoCompleteTextView etText =
(MultiAutoCompleteTextView)this.findViewById(R.id.etText);
StringBuilder mentions = new StringBuilder("");
for (User user : userList) {
mentions.append(user.getMentionName()).append(" ");
}
int currentPos = etText.getSelectionStart();
etText.getText().insert(currentPos, mentions);
}
break;
default:
break;
}
}
示例2: onActivityResult
import android.widget.MultiAutoCompleteTextView; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case Constants.REQUEST_CODE_IMG_SELECTOR:
case Constants.REQUEST_CODE_CAMERA:
break;
case Constants.REQUEST_CODE_USER_SELECTOR:
if (resultCode == Constants.RESULT_CODE_SUCCESS) {
List<User> userList = (List<User>)data.getSerializableExtra("LIST_USER");
if (ListUtil.isEmpty(userList)) {
userList = new ArrayList<User>();
}
MultiAutoCompleteTextView etText = (MultiAutoCompleteTextView)this.findViewById(R.id.etText);
StringBuilder mentions = new StringBuilder();
for (User user : userList) {
mentions.append(user.getMentionName()).append(" ");
}
int currentPos = etText.getSelectionStart();
etText.getText().insert(currentPos, mentions);
}
break;
default:
break;
}
}
示例3: onActivityResult
import android.widget.MultiAutoCompleteTextView; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case Constants.REQUEST_CODE_IMG_SELECTOR:
if (resultCode == RESULT_OK) {
updateAttachedImage(data.getData());
}
break;
case Constants.REQUEST_CODE_CAMERA:
if (resultCode != RESULT_OK) {
break;
}
Uri uri = null;
Bitmap b = null;
String imgPath = null;
if (CompatibilityUtil.hasImageCaptureBug()) {
Bundle extras = data.getExtras();
b = (Bitmap) extras.get("data"); //如果以這種方式傳遞,寬高肯定不大,否則占內存
imgPath = getImageFilePath_CameraBug();
if (imgPath.equals("")) {
uri = saveCameraImage(b);
}
updateAttachedImage(uri);
} else {
if (data == null) {
Log.v(TAG, "data intent is null!");
}
updateAttachedImage(imagePath);
}
break;
case Constants.REQUEST_CODE_USER_SELECTOR:
if (resultCode == Constants.RESULT_CODE_SUCCESS) {
List<User> userList = (List<User>)data.getSerializableExtra("LIST_USER");
if (ListUtil.isEmpty(userList)) {
userList = new ArrayList<User>();
}
MultiAutoCompleteTextView etText =
(MultiAutoCompleteTextView)this.findViewById(R.id.etText);
StringBuilder mentions = new StringBuilder("");
for (User user : userList) {
mentions.append(user.getMentionName()).append(" ");
}
int currentPos = etText.getSelectionStart();
etText.getText().insert(currentPos, mentions);
}
break;
case Constants.REQUEST_CODE_IMAGE_EDIT:
if (resultCode == Constants.RESULT_CODE_IMAGE_DELETED) {
updateAttachedImage(null, 0);
} else if (resultCode == Constants.RESULT_CODE_IMAGE_ROTATED) {
int rotation = data.getIntExtra("rotation", Integer.MIN_VALUE);
if (rotation > Integer.MIN_VALUE) {
updateAttachedImage(imagePath, rotation);
}
}
default:
break;
}
}