當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。