本文整理汇总了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;
}
}