当前位置: 首页>>代码示例>>Java>>正文


Java MultiAutoCompleteTextView.getSelectionStart方法代码示例

本文整理汇总了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;
       }
   }
 
开发者ID:cattong,项目名称:YiBo,代码行数:27,代码来源:EditCommentActivity.java

示例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;
	}
}
 
开发者ID:cattong,项目名称:YiBo,代码行数:29,代码来源:EditRetweetActivity.java

示例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;
	}
}
 
开发者ID:cattong,项目名称:YiBo,代码行数:67,代码来源:EditMicroBlogActivity.java


注:本文中的android.widget.MultiAutoCompleteTextView.getSelectionStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。