Java Code Examples for android.content.Intent.getStringArrayListExtra()

The following are Jave code examples for showing how to use getStringArrayListExtra() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: iSPY   File: MapsActivity.java   View Source Code Vote up 7 votes
/**
 * 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
}
 
Example 2
Project: Hitalk   File: BnPublishActivity.java   View Source Code Vote up 7 votes
@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);
        }
    }
}
 
Example 3
Project: boohee_v5.6   File: AddCustomFoodActivity.java   View Source Code Vote up 7 votes
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);
    }
}
 
Example 4
Project: leisure-glance   File: GalleryActivity.java   View Source Code Vote up 7 votes
@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);
}
 
Example 5
Project: boohee_v5.6   File: BecomeTeamLeaderActivity.java   View Source Code Vote up 7 votes
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;
    }
}
 
Example 6
Project: NUI_Project   File: VoiceActivity.java   View Source Code Vote up 7 votes
/**
 * 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;
        }

    }
}
 
Example 7
Project: MADBike   File: SearchActivity.java   View Source Code Vote up 7 votes
@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;
        }

    }
}
 
Example 8
Project: Cable-Android   File: GroupCreateActivity.java   View Source Code Vote up 6 votes
@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);
             }
           });
  }
}
 
Example 9
Project: FastAndroid   File: MultiAudioCallActivity.java   View Source Code Vote up 6 votes
@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);
        }
    }
}
 
Example 10
Project: q-mail   File: NotificationActionService.java   View Source Code Vote up 6 votes
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);
    }
}
 
Example 11
Project: multiselect   File: MainActivity.java   View Source Code Vote up 6 votes
@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();
  }
}
 
Example 12
Project: boohee_v5.6   File: ShareIntentUtil.java   View Source Code Vote up 6 votes
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;
    }
}
 
Example 13
Project: GitHub   File: TopMenuWindow.java   View Source Code Vote up 6 votes
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);
	}
 
Example 14
Project: SmingZZick_App   File: StickerAttacherActivity.java   View Source Code Vote up 6 votes
@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();
            }
        }
    }
}
 
Example 15
Project: NUI_Project   File: VoiceListener.java   View Source Code Vote up 6 votes
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.");
    }
}
 
Example 16
Project: wirtualnaApteczka   File: AddMedicineActivity.java   View Source Code Vote up 6 votes
private String retrievePotentialMedicineNameFromVoiceRecognizedData(Intent data) {
    List<String> voiceRecognizedData = data
            .getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);

    String potentialMedicineName = voiceRecognizedData.get(0);
    return potentialMedicineName;
}
 
Example 17
Project: chromium-for-android-56-debug-video   File: IntentUtils.java   View Source Code Vote up 6 votes
/**
 * Just like {@link Intent#getStringArrayListExtra(String)} but doesn't throw exceptions.
 */
public static ArrayList<String> safeGetStringArrayListExtra(Intent intent, String name) {
    try {
        return intent.getStringArrayListExtra(name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "getStringArrayListExtra failed on intent " + intent);
        return null;
    }
}
 
Example 18
Project: android-project-gallery   File: ImageAutoPlayImageSwitcherActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState)
{
	supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.wrapper_cn_image_autoplay);

	Intent intent = getIntent();
	mImageList = intent.getStringArrayListExtra(EXTRA_IMAGE_LIST);
	mTitle = intent.getStringExtra(EXTRA_TITLE);
	mCacheDir = intent.getStringExtra(EXTRA_DIRECTORY);
	mPeriod = intent.getIntExtra(EXTRA_PERIOD, SCROLL_PERIOD_DEFAULT);
	mPosition = intent.getIntExtra(EXTRA_POSITION, 0);
	// 默认进行图片缓存
	mCacheOnDisc = intent.getBooleanExtra(EXTRA_CACHE_ON_DISC, true);
	if (mPeriod <= 0)
	{
		mPeriod = SCROLL_PERIOD_DEFAULT;
	}
	if (TextUtils.isEmpty(mCacheDir))
	{
		// 没有地址不进行缓存, 后续看看有没有需要考虑没有地址使用默认地址的情况
		// 原则上, 在设计时, 都提供存储地址应该比较合理
		mCacheOnDisc = false;
	}

	if (TextUtils.isEmpty(mTitle))
	{
		int titleId = getResources().getIdentifier("app_name", "string", this.getPackageName());
		mTitle = getString(titleId);
	}
	getSupportActionBar().show();
	getSupportActionBar().setTitle(mTitle);
	//getSupportActionBar().setSubtitle(title + "sub");
	getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg_translucent));
	
	getUiHandler().postDelayed(new Runnable()
	{

		@Override
		public void run()
		{
			getSupportActionBar().hide();
		}
	}, ACTIONBAR_HIDE_DELAYED);
	
	
	SaveImageOptions saveOptions = new SaveImageOptions.Builder()
		.medule("Image_AutoPlay")
		.extraDir(mCacheDir)
		.build();

	DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
		.showImageForEmptyUri(R.drawable.warn_image_empty)
		.showImageOnFail(R.drawable.warn_image_error)
		.cacheInMemory(true)
		.cacheOnDisc(mCacheOnDisc)
		.considerExifParams(true)
		.bitmapConfig(Bitmap.Config.RGB_565)
		.saveImageOptions(saveOptions)
		.build();

	imageSwitcher = (XImageSwitcher) findViewById(R.id.imageSwitcher);
	imageSwitcher.setFactory(this);
	imageSwitcher.setOnClickListener(this);
	imageSwitcher.addImagePath(mImageList);
	imageSwitcher.setDisplayImageOptions(displayImageOptions);
	imageSwitcher.startAutoScroll(mPeriod, mPosition);
}
 
Example 19
Project: Recognize-it   File: GalleryActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    StatusUtils.setFullToStatusBar(this);
    Locale locale = Album.getAlbumConfig().getLocale();
    AlbumUtils.applyLanguageForContext(this, locale);
    setContentView(R.layout.album_activity_preview);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    mViewPager = (ViewPager) findViewById(R.id.view_pager);
    mCheckBox = (AppCompatCheckBox) findViewById(R.id.cb_album_check);

    Intent intent = getIntent();
    mRequestCode = intent.getIntExtra(Album.KEY_INPUT_REQUEST_CODE, 0);
    mWidget = intent.getParcelableExtra(Album.KEY_INPUT_WIDGET);
    mPathList = intent.getStringArrayListExtra(Album.KEY_INPUT_CHECKED_LIST);
    mCurrentItemPosition = intent.getIntExtra(Album.KEY_INPUT_CURRENT_POSITION, 0);
    mCheckable = intent.getBooleanExtra(Album.KEY_INPUT_GALLERY_CHECKABLE, true);
    mNavigationAlpha = intent.getIntExtra(Album.KEY_INPUT_NAVIGATION_ALPHA, 80);

    if (mPathList == null) {
        Log.e(TAG, "Parameter error.",
                new IllegalArgumentException("The checkedList can be null."));
        onGalleryCancel();
    } else if (mPathList.size() == 0 || mCurrentItemPosition == mPathList.size()) {
        Log.e(TAG, "Parameter error.",
                new IllegalArgumentException("The currentPosition is " + mCurrentItemPosition + ","
                        + " the checkedList.size() is " + mPathList.size()));
        onGalleryCancel();
    } else {
        mCheckedMap = new HashMap<>();
        for (String path : mPathList) {
            mCheckedMap.put(path, true);
        }
        initializeWidget();
        initializePager();

        requestPermission(PERMISSION_STORAGE);
    }
}
 
Example 20
Project: Matisse-Image-and-Video-Selector   File: Matisse.java   View Source Code Vote up 3 votes
/**
 * Obtain user selected media path list in the starting Activity or Fragment.
 *
 * @param data Intent passed by {@link Activity#onActivityResult(int, int, Intent)} or
 *             {@link Fragment#onActivityResult(int, int, Intent)}.
 * @return User selected media path list.
 */
public static List<String> obtainPathResult(Intent data) {
    return data.getStringArrayListExtra(MatisseActivity.EXTRA_RESULT_SELECTION_PATH);
}