本文整理汇总了Java中android.content.Intent.getStringArrayListExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getStringArrayListExtra方法的具体用法?Java Intent.getStringArrayListExtra怎么用?Java Intent.getStringArrayListExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.getStringArrayListExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapReady
import android.content.Intent; //导入方法依赖的package包/类
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
googleMap.clear();
GoToMap = googleMap;
Intent i = getIntent();
ArrayList<LatLng> list1 = i.getParcelableArrayListExtra("key1");
ArrayList<String> list2 = i.getStringArrayListExtra("key2");
ArrayList<String> list3 = i.getStringArrayListExtra("key3");
LatLng latLng = new LatLng(0, 0);
int j = list1.size();
j=j-1;
while (j!=-1)
{
if(list1.get(j)!=latLng)
{ Log.i(list1.get(j).toString(),list1.get(j).toString());
GoToMap.addMarker(new MarkerOptions().position(list1.get(j)).draggable(true).title(list3.get(j).replace(',','.')+" Battery Power "+list2.get(j)));
GoToMap.moveCamera(CameraUpdateFactory.newLatLng(list1.get(j)));
}
j--;
}
// Add a marker in Sydney and move the camera
}
示例2: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK &&
(requestCode == PhotoPicker.REQUEST_CODE || requestCode == PhotoPreview.REQUEST_CODE)) {
ArrayList<String> photos = null;
if (data != null) {
photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
}
if (photos != null) {
mLayout.setSelectedImages(photos);
}
}
}
示例3: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data != null) {
switch (requestCode) {
case 1:
List<String> path = data.getStringArrayListExtra(MultiImageSelectorActivity
.EXTRA_RESULT);
if (path != null && path.size() > 0) {
this.imgPath = (String) path.get(0);
ImageLoader.getInstance().displayImage(Uri.decode(Uri.fromFile(new File
(this.imgPath)).toString()), this.ivFoodImg, ImageLoaderOptions
.color(R.color.ju));
this.rlFoodImg.setVisibility(0);
break;
}
}
super.onActivityResult(requestCode, resultCode, data);
}
}
示例4: initData
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void initData() {
Intent intent = getIntent();
if (intent == null) {
finish();
return;
}
photos = intent.getStringArrayListExtra("photos");
if (photos == null) {
finish();
return;
}
currentPos = intent.getIntExtra("pos", 0);
adapter = new GalleryAdapter();
viewPager.setAdapter(adapter);
viewPager.setCurrentItem(currentPos);
}
示例5: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 2:
if (resultCode == -1) {
List<String> pathList = data.getStringArrayListExtra
(MultiImageSelectorActivity.EXTRA_RESULT);
if (pathList != null && pathList.size() > 0) {
if (!TextUtil.isEmpty((String) pathList.get(0))) {
uploadPicture((String) pathList.get(0));
return;
}
return;
}
return;
}
return;
default:
return;
}
}
示例6: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
/**
* Receiving speech input
* */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQ_CODE_SPEECH_INPUT: {
if (resultCode == RESULT_OK && null != data) {
ArrayList<String> result = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
txtSpeechInput.setText(result.get(0));
}
break;
}
}
}
示例7: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case RESULT_SPEECH: {
if (resultCode == RESULT_OK && null != data) {
ArrayList<String> text = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
autoCompleteTextView.setText(text.get(0));
}
break;
}
}
}
示例8: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onActivityResult(int reqCode, int resultCode, final Intent data) {
super.onActivityResult(reqCode, resultCode, data);
Uri outputFile = Uri.fromFile(new File(getCacheDir(), "cropped"));
if (data == null || resultCode != Activity.RESULT_OK)
return;
switch (reqCode) {
case PICK_CONTACT:
List<String> selected = data.getStringArrayListExtra("contacts");
for (String contact : selected) {
final Recipient recipient = RecipientFactory.getRecipientsFromString(this, contact, false).getPrimaryRecipient();
if (recipient != null) addSelectedContacts(recipient);
}
break;
case Crop.REQUEST_PICK:
new Crop(data.getData()).output(outputFile).asSquare().start(this);
break;
case Crop.REQUEST_CROP:
Glide.with(this).load(Crop.getOutput(data)).asBitmap()
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.centerCrop().override(AVATAR_SIZE, AVATAR_SIZE)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
setAvatar(Crop.getOutput(data), resource);
}
});
}
}
示例9: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS) {
if (PermissionCheckUtil.checkPermissions(this, AUDIO_CALL_PERMISSIONS)) {
if (startForCheckPermissions) {
startForCheckPermissions = false;
RongCallClient.getInstance().onPermissionGranted();
} else {
initView();
}
} else {
if (startForCheckPermissions) {
startForCheckPermissions = false;
RongCallClient.getInstance().onPermissionDenied();
} else {
finish();
}
}
} else {
if (callSession.getEndTime() != 0) {
finish();
return;
}
shouldShowFloat = true;
if (resultCode == RESULT_OK) {
ArrayList<String> invited = data.getStringArrayListExtra("invited");
RongCallClient.getInstance().addParticipants(callSession.getCallId(), invited);
}
}
}
示例10: markMessagesAsRead
import android.content.Intent; //导入方法依赖的package包/类
private void markMessagesAsRead(Intent intent, Account account, MessagingController controller) {
Timber.i("NotificationActionService marking messages as read");
List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
for (MessageReference messageReference : messageReferences) {
String folderName = messageReference.getFolderId();
String uid = messageReference.getUid();
controller.setFlag(account, folderName, uid, Flag.SEEN, true);
}
}
示例11: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == com.veer.multiselect.Util.Constants.REQUEST_CODE_MULTISELECT
&& resultCode == RESULT_OK) {
paths = data.getStringArrayListExtra(com.veer.multiselect.Util.Constants.GET_PATHS);
rcItems.getAdapter().notifyDataSetChanged();
}
}
示例12: getStringArrayListExtra
import android.content.Intent; //导入方法依赖的package包/类
public static ArrayList<String> getStringArrayListExtra(Intent intent, String name) {
if (intent == null) {
return null;
}
try {
return intent.getStringArrayListExtra(name);
} catch (Exception e) {
Log.e(TAG, "getStringExtra exception:" + e.getMessage());
return null;
}
}
示例13: init
import android.content.Intent; //导入方法依赖的package包/类
private void init() {
llTopMenuWindowBg = findViewById(R.id.llTopMenuWindowBg);
llTopMenuWindowBg.setOnClickListener(this);
Intent intent = getIntent();
int[] intentCodes = intent.getIntArrayExtra(INTENT_INTENTCODES);
if (intentCodes == null || intentCodes.length <= 0) {
intentCodeList = intent.getIntegerArrayListExtra(INTENT_INTENTCODES);
} else {
intentCodeList = new ArrayList<Integer>();
for (int code : intentCodes) {
intentCodeList.add(code);
}
}
String[] menuItems = intent.getStringArrayExtra(INTENT_NAMES);
if (menuItems == null || menuItems.length <= 0) {
nameList = intent.getStringArrayListExtra(INTENT_NAMES);
} else {
nameList = new ArrayList<String>(Arrays.asList(menuItems));
}
if (nameList == null || nameList.size() <= 0) {
Log.e(TAG, "init nameList == null || nameList.size() <= 0 >> finish();return;");
finish();
return;
}
adapter = new ArrayAdapter<String>(this, R.layout.top_menu_list_item, R.id.tvTopMenuListItem, nameList);
lvTopMenu = (ListView) findViewById(R.id.lvTopMenuWindowMenu);
lvTopMenu.setAdapter(adapter);
lvTopMenu.setOnItemClickListener(this);
}
示例14: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != RESULT_OK) {
return;
}
if (data == null) {
return;
}
ArrayList<String> photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
if (photos == null) {
return;
}
for (String photo : photos) {
File file = new File(photo);
if (file != null && file.exists() == true && file.isFile() == true) {
File destFile = new File(Constant.getStickerDirectory(), file.getName());
try {
Util.copy(file, destFile);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
示例15: getResult
import android.content.Intent; //导入方法依赖的package包/类
public VoiceResult getResult(int resultCode, Intent data) {
if (hasFailureMessage()) {
String message = popErrorMessage();
return new VoiceResult(false, message);
}
else if (resultCode == RESULT_OK && null != data) {
ArrayList<String> result = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
String value = result.get(0);
return new VoiceResult(true, value);
}
else {
throw new RuntimeException("VoiceListener failed to return an expected result.");
}
}