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

The following examples show how to use android.content.Intent#getStringArrayListExtra() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);

	switch (requestCode) {
		
		case 1: {
			if (resultCode == RESULT_OK && data != null) {
				setMicIcon(false, false);
				ArrayList<String> text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
				editTextForGoogle.setText(text.get(0));
				txt.setText("Status: Done!");
			}
			break;
		}
	}
}
 
Example 2
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);

	Log.v(TAG, "onActivityResult: resultCode=" + resultCode + " i=" + data);

	if (requestCode == REQUEST_FILTER) {
		if (resultCode == Activity.RESULT_OK) {
			m_app.m_prios = Priority.toPriority(data
					.getStringArrayListExtra(Constants.EXTRA_PRIORITIES));
			m_app.m_projects = data
					.getStringArrayListExtra(Constants.EXTRA_PROJECTS);
			m_app.m_contexts = data
					.getStringArrayListExtra(Constants.EXTRA_CONTEXTS);
			m_app.m_search = data.getStringExtra(Constants.EXTRA_SEARCH);
			m_app.m_filters = data
					.getStringArrayListExtra(Constants.EXTRA_APPLIED_FILTERS);
			setDrawerChoices();
			m_app.storeFilters();
			setFilteredTasks(false);
		}
	} else if (requestCode == REQUEST_PREFERENCES) {
		/* Do nothing */
	}
}
 
Example 3
Source Project: EasyPhotos   File: PuzzleActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == Code.REQUEST_SETTING_APP_DETAILS) {
        if (PermissionUtil.checkAndRequestPermissionsInActivity(this, getNeedPermissions())) {
            savePhoto();
        }
        return;
    }
    switch (resultCode) {
        case RESULT_OK:

            ArrayList<Photo> photos = data.getParcelableArrayListExtra(EasyPhotos.RESULT_PHOTOS);
            ArrayList<String> paths = data.getStringArrayListExtra(EasyPhotos.RESULT_PATHS);

            dealResult(photos, paths);

            break;
        case RESULT_CANCELED:
            break;
        default:
            break;
    }
}
 
Example 4
Source Project: PhotoPicker   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@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)) {

    List<String> photos = null;
    if (data != null) {
      photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
    }
    selectedPhotos.clear();

    if (photos != null) {

      selectedPhotos.addAll(photos);
    }
    photoAdapter.notifyDataSetChanged();
  }
}
 
Example 5
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_packages_selector_content);

    final Intent intent = getIntent();
    if (intent != null) {
        mLastSelectedPackages = intent.getStringArrayListExtra(EXTRA_SELECTED);
    }

    final ActionBar actionBar = requireNonNull(getActionBar());
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeAsUpIndicator(R.drawable.ic_close_black_24dp);

    mRecyclerView = findViewById(android.R.id.list);
    mProgressBar = findViewById(android.R.id.progress);

    mAdapter.onRestoreInstanceState(savedInstanceState);
    mRecyclerView.setAdapter(mAdapter);

    if (savedInstanceState == null) {
        loadAppInfoListAsync();
    }
}
 
Example 6
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);

	switch (requestCode) {
		
		case 1: {
			if (resultCode == RESULT_OK && data != null) {
				setMicIcon(false, false);
				ArrayList<String> text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
				editTextForGoogle.setText(text.get(0));
				txt.setText("Status: Done!");
			}
			break;
		}
	}
}
 
Example 7
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
        case 1: {
            if (resultCode == RESULT_OK && null != data) {

                /* Switch language within current context for voice recognition */
                Context context = LangContext.load(getApplicationContext(), contextLang[0]);

                ArrayList<String> input = data
                        .getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
                Amadeus.responseToInput(input.get(0), context, MainActivity.this);
            }
            break;
        }

    }
}
 
Example 8
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(resultCode != Activity.RESULT_OK) {
        return;
    }

    final Conversation conversation = getCurrentConversation();
    Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO);
    ArrayList<String> userIds = data.getStringArrayListExtra("invited");
    userIds.add(RongIMClient.getInstance().getCurrentUserId());
    intent.putExtra("conversationType", conversation.getConversationType().getName().toLowerCase());
    intent.putExtra("targetId", conversation.getTargetId());
    intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
    intent.putStringArrayListExtra("invitedUsers", userIds);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage(getContext().getPackageName());
    getContext().getApplicationContext().startActivity(intent);
}
 
Example 9
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    switch (requestCode) {
        case 0:
            if (data != null) {
                List<String> selectDate = data.getStringArrayListExtra("data");
                selectTimeText.setText(Utils.listToString(selectDate));
            }
            break;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
Example 10
Source Project: PhotoPicker   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode == PICK_PHOTO){
        if(resultCode == RESULT_OK){
            ArrayList<String> result = data.getStringArrayListExtra(PhotoPickerActivity.KEY_RESULT);
            showResult(result);
        }
    }
}
 
Example 11
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK) {
        if (requestCode == OnboardingManager.REQUEST_SCAN) {

            ArrayList<String> resultScans = data.getStringArrayListExtra("result");
            for (String resultScan : resultScans)
            {

                try {
                    //parse each string and if they are for a new user then add the user
                    OnboardingManager.DecodedInviteLink diLink = OnboardingManager.decodeInviteLink(resultScan);

                    new AddContactAsyncTask(mApp.getDefaultProviderId(),mApp.getDefaultAccountId()).execute(diLink.username, diLink.fingerprint, diLink.nickname);

                    //if they are for a group chat, then add the group
                }
                catch (Exception e)
                {
                    Log.w(LOG_TAG, "error parsing QR invite link", e);
                }
            }
        }

    }
}
 
Example 12
Source Project: RoMote   File: RemoteFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode,
                                Intent data) {
    if (requestCode == SPEECH_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
        List<String> results = data.getStringArrayListExtra(
                RecognizerIntent.EXTRA_RESULTS);
        String spokenText = results.get(0);
        // Do something with spokenText
        //mTextBox.setText(spokenText);
        //Toast.makeText(getActivity(), spokenText, Toast.LENGTH_LONG).show();
    }
    super.onActivityResult(requestCode, resultCode, data);
}
 
Example 13
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    Intent intent = getIntent();
    String message = intent.getStringExtra(MESSAGE); 
    ArrayList<String> list = intent.getStringArrayListExtra(EXTRA_LIST);
    ArrayList<String> list2 = intent.getStringArrayListExtra(EXTRA_LIST_2);
    
    setContentView(R.layout.generic_explanation);
    
    if (message != null) {
        TextView textView = (TextView) findViewById(R.id.message);
        textView.setText(message);
        textView.setMovementMethod(new ScrollingMovementMethod());
    }
    
    ListView listView = (ListView) findViewById(R.id.list);
    if (list != null && list.size() > 0) {
        //ListAdapter adapter = new ArrayAdapter<String>(this,
        // android.R.layout.simple_list_item_1, list);
        ListAdapter adapter = new ExplanationListAdapterView(this, list, list2);
        listView.setAdapter(adapter);
    } else {
        listView.setVisibility(View.GONE);
    }
}
 
Example 14
@Override
protected void initView() {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT <Build.VERSION_CODES.LOLLIPOP)
        StatusBarUtil.setHeightAndPadding(this, tlCommon);
    Intent intent = getIntent();
    for (String s : intent.getStringArrayListExtra(Constant.KEY_HIERARCHY_ID))
        mIds.add(Integer.valueOf(s));
    mTitles = intent.getStringArrayListExtra(Constant.KEY_HIERARCHY_NAMES);
    mTitle = intent.getStringExtra(Constant.KEY_HIERARCHY_NAME);
    initToolBar();
    initViewPager();
    fbtnUp.setOnClickListener(v -> RxBus.getInstance().post(new ToppingEvent()));
}
 
Example 15
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode == REQUEST_IMAGE){
        if(resultCode == RESULT_OK){
            mSelectPath = data.getStringArrayListExtra(com.marshalchen.common.uimodule.multi_image_selector.MultiImageSelectorActivity.EXTRA_RESULT);
            StringBuilder sb = new StringBuilder();
            for(String p: mSelectPath){
                sb.append(p);
                sb.append("\n");
            }
            mResultText.setText(sb.toString());
        }
    }
}
 
Example 16
Source Project: imsdk-android   File: HolderFragment.java    License: MIT License 5 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (Activity.RESULT_OK == resultCode) {
        switch (requestCode) {
            case HOLDER_SELECT_REQUEST_CODE:
                if (mSelectCallback != null) {
                    ArrayList<Photo> resultPhotos = data.getParcelableArrayListExtra(EasyPhotos.RESULT_PHOTOS);
                    ArrayList<String> resultPaths = data.getStringArrayListExtra(EasyPhotos.RESULT_PATHS);
                    boolean selectedOriginal = data.getBooleanExtra(EasyPhotos.RESULT_SELECTED_ORIGINAL, false);
                    mSelectCallback.onResult(resultPhotos, resultPaths, selectedOriginal);
                }
                break;
            case HOLDER_PUZZLE_REQUEST_CODE:
                if (mPuzzleCallback != null) {
                    Photo puzzlePhoto = data.getParcelableExtra(EasyPhotos.RESULT_PHOTOS);
                    String puzzlePath = data.getStringExtra(EasyPhotos.RESULT_PATHS);
                    mPuzzleCallback.onResult(puzzlePhoto, puzzlePath);
                }
                break;
            default:
                Log.e("EasyPhotos", "requestCode error : " + requestCode);
                break;
        }
    } else {
        Log.e("EasyPhotos", "resultCode is not RESULT_OK: " + resultCode);
    }
}
 
Example 17
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE && resultCode == RESULT_OK) {
        if (data != null) {
            mSubreddits = data.getStringArrayListExtra(
                    SubredditMultiselectionActivity.EXTRA_RETURN_SELECTED_SUBREDDITS);
        }
    }
}
 
Example 18
/**
 * Fragment容器onActivityResult时触发长期回调即页面跳转回传值
 *
 * @param requestCode 请求code
 * @param resultCode  返回code
 * @param data        回传数据
 */
@Override
public void onResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        final Map<String, Object> object = new HashMap<>();
        object.put("resultCode", resultCode);
        if (requestCode == INTENT_REQUEST_CODE) {
            //页面跳转回传值
            String jsonStr = data == null ? "" : data.getStringExtra(RESULT_DATA);
            object.put(RESULT_DATA, jsonStr);
            autoCallbackEvent.onPageResult(object);
        } else if (requestCode == IntentIntegrator.REQUEST_CODE) {
            //扫描二维码回传值
            IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            String ewmString = result.getContents();
            object.put(RESULT_DATA, ewmString == null ? "" : ewmString);
            autoCallbackEvent.onScanCode(object);
        } else if (requestCode == PhotoPicker.REQUEST_CODE || requestCode == PhotoPreview.REQUEST_CODE) {
            //选择或预览图片回传值
            ArrayList<String> photos = null;
            if (data != null) {
                photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
            }
            object.put(RESULT_DATA, photos == null ? "" : photos);
            autoCallbackEvent.onChoosePic(object);

        } else if (requestCode == CAMERA_REQUEST_CODE) {
            //拍照
            if (photoSelector != null) {
                photoSelector.handleCamera(new PhotoSelector.CompressResult() {
                    @Override
                    public void onCompelete(String path) {
                        object.put(RESULT_DATA, path);
                        autoCallbackEvent.onChoosePic(object);
                    }
                });
            }

        }
    }

    //浏览器支持file控件选择文件
    pageLoad.getFileChooser().onChooseFileResult(requestCode, resultCode, data);
}
 
Example 19
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent resultIntent) {

    if (resultCode == RESULT_OK) {

        if (requestCode == REQUEST_PICK_CONTACTS) {

            ArrayList<String> invitees = new ArrayList<String>();

            String username = resultIntent.getStringExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAME);

            if (username != null)
                invitees.add(username);
            else
                invitees = resultIntent.getStringArrayListExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAMES);

            inviteContacts(invitees);

            mHandler.postDelayed(() -> updateSession(),3000);
        }
    }
}
 
Example 20
public void onCreate(final Bundle savedInstanceState) {

		PrefsUtility.applyTheme(this);

		super.onCreate(savedInstanceState);

		setTitle(R.string.app_name);

		// TODO load from savedInstanceState

		final View layout = getLayoutInflater().inflate(R.layout.main_single, null);
		setBaseActivityContentView(layout);
		mPane = (FrameLayout)layout.findViewById(R.id.main_single_frame);

		RedditAccountManager.getInstance(this).addUpdateListener(this);

		if(getIntent() != null) {

			final Intent intent = getIntent();
			mSearchString = intent.getStringExtra(EXTRA_SEARCH_STRING);

			final ArrayList<String> commentIds = intent.getStringArrayListExtra("commentIds");
			final String postId = intent.getStringExtra("postId");

			for(final String commentId : commentIds) {
				mUrls.add(PostCommentListingURL.forPostId(postId).commentId(commentId));
			}

			doRefresh(RefreshableFragment.COMMENTS, false, null);

		} else {
			throw new RuntimeException("Nothing to show! (should load from bundle)"); // TODO
		}
	}