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

The following examples show how to use android.content.Intent#getStringArrayExtra() . 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
Source File: ChildProcessService.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public IBinder onBind(Intent intent) {
    // We call stopSelf() to request that this service be stopped as soon as the client
    // unbinds. Otherwise the system may keep it around and available for a reconnect. The
    // child processes do not currently support reconnect; they must be initialized from
    // scratch every time.
    stopSelf();

    synchronized (mMainThread) {
        mCommandLineParams = intent.getStringArrayExtra(
                ChildProcessConnection.EXTRA_COMMAND_LINE);
        mLinkerParams = null;
        if (Linker.isUsed())
            mLinkerParams = new LinkerParams(intent);
        mIsBound = true;
        mMainThread.notifyAll();
    }

    return mBinder;
}
 
Example 2
Source File: ShareCompat.java    From letv with Apache License 2.0 6 votes vote down vote up
private void combineArrayExtra(String extra, String[] add) {
    int oldLength;
    Intent intent = getIntent();
    String[] old = intent.getStringArrayExtra(extra);
    if (old != null) {
        oldLength = old.length;
    } else {
        oldLength = 0;
    }
    String[] result = new String[(add.length + oldLength)];
    if (old != null) {
        System.arraycopy(old, 0, result, 0, oldLength);
    }
    System.arraycopy(add, 0, result, oldLength, add.length);
    intent.putExtra(extra, result);
}
 
Example 3
Source File: ContactPickerActivity.java    From UnifiedContactPicker with Apache License 2.0 6 votes vote down vote up
private void readExtras() {
    Intent intent = getIntent();
    if(intent != null){
        this.showChips = intent.getBooleanExtra(CP_EXTRA_SHOW_CHIPS, true);
        this.hasCustomArgs = intent.getBooleanExtra(CP_EXTRA_HAS_CUSTOM_SELECTION_ARGS, false);
        this.projection = intent.getStringArrayExtra(CP_EXTRA_PROJECTION);
        this.select = intent.getStringExtra(CP_EXTRA_SELECTION);
        this.selectArgs = intent.getStringArrayExtra(CP_EXTRA_SELECTION_ARGS);
        this.sortBy = intent.getStringExtra(CP_EXTRA_SORT_BY);
        this.selectedColor = intent.getStringExtra(CP_EXTRA_SELECTION_COLOR);
        this.fabColor = intent.getStringExtra(CP_EXTRA_FAB_COLOR);
        this.fabDrawable = intent.getByteArrayExtra(CP_EXTRA_FAB_DRAWABLE);
        this.selectedDrawable = intent.getByteArrayExtra(CP_EXTRA_SELECTION_DRAWABLE);
        cleanIfNeeded();
    }
}
 
Example 4
Source File: ChooseTypeAndAccountActivity.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Return a set of account types specified by the intent as well as supported by the
 * AccountManager.
 */
private Set<String> getReleventAccountTypes(final Intent intent) {
  // An account type is relevant iff it is allowed by the caller and supported by the account
  // manager.
  Set<String> setOfRelevantAccountTypes = null;
  final String[] allowedAccountTypes =
          intent.getStringArrayExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY);
    AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes();
    Set<String> supportedAccountTypes = new HashSet<String>(descs.length);
    for (AuthenticatorDescription desc : descs) {
        supportedAccountTypes.add(desc.type);
    }
    if (allowedAccountTypes != null) {
        setOfRelevantAccountTypes = Sets.newHashSet(allowedAccountTypes);
        setOfRelevantAccountTypes.retainAll(supportedAccountTypes);
    } else {
        setOfRelevantAccountTypes = supportedAccountTypes;
  }
  return setOfRelevantAccountTypes;
}
 
Example 5
Source File: EmailTest.java    From shelly with Apache License 2.0 6 votes vote down vote up
@Test
public void manyBccUsingVarargs() {
    Context currentContext = mock(Context.class);
    ArgumentCaptor<Intent> argument = ArgumentCaptor.forClass(Intent.class);

    Shelly.email(currentContext)
            .bcc("1", "2")
            .send();

    verify(currentContext).startActivity(argument.capture());

    Intent result = argument.getValue();
    String[] to = result.getStringArrayExtra(Intent.EXTRA_BCC);
    assertEquals(2, to.length);
    assertEquals("1", to[0]);
    assertEquals("2", to[1]);
}
 
Example 6
Source File: MQTTService.java    From android-mqtt-service with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    try {
        Intent intent = mIntents.take();
        String action = intent.getAction();
        String requestId = getParameter(intent, PARAM_REQUEST_ID);

        if (ACTION_CONNECT.equals(action) || ACTION_CONNECT_AND_SUBSCRIBE.equals(action)) {
            boolean connected = onConnect(requestId, getParameter(intent, PARAM_BROKER_URL),
                    getParameter(intent, PARAM_CLIENT_ID), getParameter(intent, PARAM_USERNAME),
                    getParameter(intent, PARAM_PASSWORD));

            if (ACTION_CONNECT_AND_SUBSCRIBE.equals(action) && connected) {
                int qos = getInt(getParameter(intent, PARAM_QOS));
                String[] topics = intent.getStringArrayExtra(PARAM_TOPICS);
                boolean autoResubscribe = intent.getBooleanExtra(PARAM_AUTO_RESUBSCRIBE_ON_RECONNECT, false);
                onSubscribe(requestId, qos, autoResubscribe, topics);
            }

        } else if (ACTION_DISCONNECT.equals(action)) {
            onDisconnect(requestId);

        } else if (ACTION_SUBSCRIBE.equals(action)) {
            onSubscribe(requestId, getInt(getParameter(intent, PARAM_QOS)),
                    intent.getBooleanExtra(PARAM_AUTO_RESUBSCRIBE_ON_RECONNECT, false),
                    intent.getStringArrayExtra(PARAM_TOPICS));

        } else if (ACTION_PUBLISH.equals(action)) {
            onPublish(requestId, getParameter(intent, PARAM_TOPIC), intent.getByteArrayExtra(PARAM_PAYLOAD));

        } else if (ACTION_CHECK_CONNECTION.equals(action)) {
            broadcastConnectionStatus(requestId);
        }
    } catch (Throwable exc) {
        MQTTServiceLogger.error(getClass().getSimpleName(), "Error while processing command", exc);
    }
}
 
Example 7
Source File: PermissionActivity.java    From SAF-AOP with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    permissions = intent.getStringArrayExtra("permissions");
    requestCode = intent.getIntExtra("requestcode", 0);
    setContentView(R.layout.activity_permission);
    if (permissions != null && permissions.length > 0) {
        requestPermission(permissions);
    }
}
 
Example 8
Source File: MainActivity.java    From MultipleImagePicker with 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);
       imagePaths = new ArrayList<String>();
	if (requestCode == 100 && resultCode == Activity.RESULT_OK) {
		adapter.clear();

		viewSwitcher.setDisplayedChild(1);
		String single_path = data.getStringExtra("single_path");
           imagePaths.add(single_path);
		imageLoader.displayImage("file://" + single_path, imgSinglePick);

	} else if (requestCode == 200 && resultCode == Activity.RESULT_OK) {
		String[] all_path = data.getStringArrayExtra("all_path");

		ArrayList<CustomGallery> dataT = new ArrayList<CustomGallery>();

		for (String string : all_path) {
			CustomGallery item = new CustomGallery();
			item.sdcardPath = string;
               imagePaths.add(string);
			dataT.add(item);
		}

		viewSwitcher.setDisplayedChild(0);
		adapter.addAll(dataT);
	}
}
 
Example 9
Source File: KJGalleryActivity.java    From CoreModule with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gallery_activity_kjgallery);

    Intent from = getIntent();
    imageUrls = from.getStringArrayExtra(URL_KEY);
    index = from.getIntExtra(URL_INDEX, 0);
    initWidget();
}
 
Example 10
Source File: RegistrationActivity.java    From account-authenticator with Apache License 2.0 5 votes vote down vote up
private void getParamsFromIntent(Intent intent) {
    if (intent != null) {
        accountType = intent.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE);
        authTokenType = intent.getStringExtra(AuthenticatorManager.KEY_AUTH_TOKEN_TYPE);
        requiredFeatures = intent.getStringArrayExtra(AuthenticatorManager.KEY_REQUIRED_FEATURES);
        options = intent.getBundleExtra(AuthenticatorManager.KEY_AUTH_ACCOUNT_OPTIONS);
        isFromGetAuth = options.getBoolean(AuthenticatorManager.KEY_IS_ADD_FROM_INSIDE_APP, false);
        isAddingNewAccount = options.getBoolean(AuthenticatorManager.KEY_IS_ADDING_NEW_ACCOUNT, false);
        accountName = options.getString(AccountManager.KEY_ACCOUNT_NAME, null);
    }
}
 
Example 11
Source File: QRCodeEncoder.java    From reacteu-app with MIT License 5 votes vote down vote up
private void encodeFromTextExtras(Intent intent) throws WriterException {
  // Notice: Google Maps shares both URL and details in one text, bummer!
  String theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_TEXT));
  if (theContents == null) {
    theContents = ContactEncoder.trim(intent.getStringExtra("android.intent.extra.HTML_TEXT"));
    // Intent.EXTRA_HTML_TEXT
    if (theContents == null) {
      theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_SUBJECT));
      if (theContents == null) {
        String[] emails = intent.getStringArrayExtra(Intent.EXTRA_EMAIL);
        if (emails != null) {
          theContents = ContactEncoder.trim(emails[0]);
        } else {
          theContents = "?";
        }
      }
    }
  }

  // Trim text to avoid URL breaking.
  if (theContents == null || theContents.length() == 0) {
    throw new WriterException("Empty EXTRA_TEXT");
  }
  contents = theContents;
  // We only do QR code.
  format = BarcodeFormat.QR_CODE;
  if (intent.hasExtra(Intent.EXTRA_SUBJECT)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_SUBJECT);
  } else if (intent.hasExtra(Intent.EXTRA_TITLE)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_TITLE);
  } else {
    displayContents = contents;
  }
  title = activity.getString(fakeR.getId("string", "contents_text"));
}
 
Example 12
Source File: CreateRoomActivity.java    From yiim_v2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	// TODO Auto-generated method stub
	if (requestCode == REQ_INVITE && resultCode == RESULT_OK) {
		mSelectedFriends = data.getStringArrayExtra("friends");
	}
	super.onActivityResult(requestCode, resultCode, data);
}
 
Example 13
Source File: NotificationDismissReceiver.java    From android-permissions with MIT License 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    String[] permissions = intent.getStringArrayExtra(PermissionsActivity.EXTRA_PERMISSIONS);

    if (new AppStatus(context).isInForeground()) {
        showPermissionsDialog(context, permissions);
    } else {
        PermissionManager.getInstance(context).removePendingPermissionRequests(asList(permissions));
    }

    logger.i("Pending permission notification dismissed. Cancelling: " + Arrays.toString(permissions));
}
 
Example 14
Source File: ImageZoomActivity.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
private void receiveIntent() {
    Intent intent = getIntent();
    mGalleryUrls = intent.getStringArrayExtra(KEY_GALLERY_URLS);
    mCurrentUrl = intent.getStringExtra(KEY_GALLERY_CUR_URL);
    if (mGalleryUrls == null ) {
        mGalleryUrls = new String[1];
        mGalleryUrls[0] = mCurrentUrl;
    }
    mPageIndex = Arrays.asList(mGalleryUrls).indexOf(mCurrentUrl);
    if (mPageIndex < 0) {
        mPageIndex = 0;
    }
    mDownloadResults = new SaveImageTask.DownloadResult[mGalleryUrls.length];
}
 
Example 15
Source File: ContentShellActivity.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private static String[] getCommandLineParamsFromIntent(Intent intent) {
    return intent != null ? intent.getStringArrayExtra(COMMAND_LINE_ARGS_KEY) : null;
}
 
Example 16
Source File: PlayerActivity.java    From leafpicrevived with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Internal methods
 */
private void initializePlayer() {
    Intent intent = getIntent();
    boolean needNewPlayer = player == null;
    if (needNewPlayer) {

        TrackSelection.Factory adaptiveTrackSelectionFactory =
                new AdaptiveTrackSelection.Factory(BANDWIDTH_METER);

        trackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory);
        trackSelectionHelper = new TrackSelectionHelper(trackSelector, adaptiveTrackSelectionFactory, getThemeHelper());
        lastSeenTrackGroupArray = null;

        UUID drmSchemeUuid = intent.hasExtra(DRM_SCHEME_UUID_EXTRA)
                ? UUID.fromString(intent.getStringExtra(DRM_SCHEME_UUID_EXTRA)) : null;
        DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = null;
        if (drmSchemeUuid != null) {
            String drmLicenseUrl = intent.getStringExtra(DRM_LICENSE_URL);
            String[] keyRequestPropertiesArray = intent.getStringArrayExtra(DRM_KEY_REQUEST_PROPERTIES);
            boolean multiSession = intent.getBooleanExtra(DRM_MULTI_SESSION, false);
            int errorStringId = R.string.error_drm_unknown;
            try {
                drmSessionManager = buildDrmSessionManagerV18(drmSchemeUuid, drmLicenseUrl,
                        keyRequestPropertiesArray, multiSession);
            } catch (UnsupportedDrmException e) {
                errorStringId = e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
                        ? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown;
            }
            if (drmSessionManager == null) {
                showToast(errorStringId);
                return;
            }
        }
        DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(this,
                drmSessionManager, DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER);
        player = ExoPlayerFactory.newSimpleInstance(this.context, trackSelector);
        player.addListener(new PlayerEventListener());
        simpleExoPlayerView.setPlayer(player);
        player.setPlayWhenReady(shouldAutoPlay);
        if (Prefs.getLoopVideo()) {
            player.setRepeatMode(Player.REPEAT_MODE_ALL);
        } else {
            player.setRepeatMode(Player.REPEAT_MODE_OFF);
        }
    }

    String action = intent.getAction();
    Uri[] uris;
    String[] extensions;
    if (intent.getData() != null && intent.getType() != null) {
        uris = new Uri[]{intent.getData()};
        extensions = new String[]{intent.getType()};
    } else {
        // TODO: 12/7/16 asdasd
        showToast(getString(R.string.unexpected_intent_action, action));
        return;
    }

    MediaSource[] mediaSources = new MediaSource[uris.length];
    for (int i = 0; i < uris.length; i++) {
        mediaSources[i] = buildMediaSource(uris[i], extensions[i]);
    }
    MediaSource mediaSource = mediaSources.length == 1 ? mediaSources[0]
            : new ConcatenatingMediaSource(mediaSources);

    boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
    if (haveResumePosition) {
        player.seekTo(resumeWindow, resumePosition);
    }
    player.prepare(mediaSource, !haveResumePosition, false);
    inErrorState = false;
    supportInvalidateOptionsMenu();

}
 
Example 17
Source File: MyPreferences.java    From audio-analyzer-for-android with Apache License 2.0 4 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();

    // Get list of default sources
    Intent intent = getIntent();
    final int[] asid = intent.getIntArrayExtra(AnalyzerActivity.MYPREFERENCES_MSG_SOURCE_ID);
    final String[] as = intent.getStringArrayExtra(AnalyzerActivity.MYPREFERENCES_MSG_SOURCE_NAME);

    int nExtraSources = 0;
    for (int id : asid) {
        // See SamplingLoop::run() for the magic number 1000
        if (id >= 1000) nExtraSources++;
    }

    // Get list of supported sources
    AnalyzerUtil au = new AnalyzerUtil(this);
    final int[] audioSourcesId = au.GetAllAudioSource(4);
    Log.i(TAG, " n_as = " + audioSourcesId.length);
    Log.i(TAG, " n_ex = " + nExtraSources);
    audioSourcesName = new String[audioSourcesId.length + nExtraSources];
    for (int i = 0; i < audioSourcesId.length; i++) {
        audioSourcesName[i] = au.getAudioSourceName(audioSourcesId[i]);
    }

    // Combine these two sources
    audioSources = new String[audioSourcesName.length];
    int j = 0;
    for (; j < audioSourcesId.length; j++) {
        audioSources[j] = String.valueOf(audioSourcesId[j]);
    }
    for (int i = 0; i < asid.length; i++) {
        // See SamplingLoop::run() for the magic number 1000
        if (asid[i] >= 1000) {
            audioSources[j] = String.valueOf(asid[i]);
            audioSourcesName[j] = as[i];
            j++;
        }
    }

    final ListPreference lp = (ListPreference) findPreference("audioSource");
    lp.setDefaultValue(MediaRecorder.AudioSource.VOICE_RECOGNITION);
    lp.setEntries(audioSourcesName);
    lp.setEntryValues(audioSources);

    getPreferenceScreen().getSharedPreferences()
            .registerOnSharedPreferenceChangeListener(prefListener);
}
 
Example 18
Source File: FragmentActApply.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) {
        switch (requestCode) {
            case 21://select
            case 71://radio
                if (mCurrentJoinFiled == null) {
                    return;
                }
                mCurrentJoinFiled.setDefaultValue(data.getStringExtra("selected"));
                if (mAdapter != null) {
                    mAdapter.notifyDataSetChanged();
                }
                break;
            case 51://list
            case 61://checkbox
                if (mCurrentJoinFiled == null) {
                    return;
                }
                mCurrentJoinFiled.selected_multi = data.getStringArrayExtra("selected_multi");
                if (mAdapter != null) {
                    mAdapter.notifyDataSetChanged();
                }
                break;
            case 81://file
                Intent intent = data;
                List<ImageBean> images = (List<ImageBean>) intent
                        .getSerializableExtra("images");
                if (images == null || images.size() < 1) {
                    return;
                }
                ImageBean imageBean = images.get(0);
                if (TextUtils.isEmpty(imageBean.path)) {
                    return;
                }
                Bitmap bitmap = null;
                DisplayImageOptions options = ImageLibUitls.getDisplayImageOptions(
                        getResources().getDrawable(com.kit.imagelib.R.drawable.no_picture), getResources().getDrawable(com.kit.imagelib.R.drawable.no_picture));
                try {
                    ImageSize targetSize = new ImageSize(80, 80); // result Bitmap will be fit to this size
                    bitmap = ImageLoader.getInstance().loadImageSync("file://" + imageBean.path, targetSize, options);
                } catch (Throwable e) {
                    e.printStackTrace();
                }
                if (bitmap != null) {
                    mCurrentJoinFiled.setDefaultValue(imageBean.path);
                    if (mAdapter != null) {
                        mAdapter.notifyDataSetChanged();
                    }
                }
                break;
        }
    }
}
 
Example 19
Source File: FUFService.java    From FreezeYou with Apache License 2.0 4 votes vote down vote up
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    boolean freeze = intent.getBooleanExtra("freeze", false);
    Context context = getApplicationContext();
    if (intent.getBooleanExtra("single", false)) {
        String pkgName = intent.getStringExtra("pkgName");
        String target = intent.getStringExtra("target");
        String tasks = intent.getStringExtra("tasks");
        boolean askRun = intent.getBooleanExtra("askRun", false);
        boolean runImmediately = intent.getBooleanExtra("runImmediately", false);
        AppPreferences appPreferences = new AppPreferences(context);
        int apiMode = appPreferences.getInt("selectFUFMode", 0);
        if (apiMode == 0) {
            if (freeze) {
                if (Build.VERSION.SDK_INT >= 21 && isDeviceOwner(context)) {
                    if (processMRootAction(context, pkgName, target, tasks, true, askRun, false, null, false)) {
                        if (!(appPreferences.getBoolean("lesserToast", false))) {
                            showToast(context, R.string.freezeCompleted);
                        }
                    } else {
                        showToast(context, R.string.failed);
                    }
                } else {
                    if (processRootAction(pkgName, target, tasks, context, false, askRun, false, null, false)) {
                        if (!(new AppPreferences(context).getBoolean("lesserToast", false))) {
                            showToast(context, R.string.executed);
                        }
                    } else {
                        showToast(context, R.string.failed);
                    }
                }
            } else {
                if (checkMRootFrozen(context, pkgName)) {
                    if (processMRootAction(context, pkgName, target, tasks, false, askRun, runImmediately, null, false)) {
                        if (!(new AppPreferences(context).getBoolean("lesserToast", false))) {
                            showToast(context, R.string.UFCompleted);
                        }
                    } else {
                        showToast(context, R.string.failed);
                    }
                } else {
                    if (processRootAction(pkgName, target, tasks, context, true, askRun, runImmediately, null, false)) {
                        if (!(new AppPreferences(context).getBoolean("lesserToast", false))) {
                            showToast(context, R.string.executed);
                        }
                    } else {
                        showToast(context, R.string.failed);
                    }
                }
            }
        } else {
            if (processAction(pkgName, target, tasks, context, !freeze, askRun, runImmediately, null, false, apiMode)) {
                if (!(new AppPreferences(context).getBoolean("lesserToast", false))) {
                    showToast(context, R.string.executed);
                }
            } else {
                showToast(context, R.string.failed);
            }
        }
    } else {
        String[] packages = intent.getStringArrayExtra("packages");
        if (Build.VERSION.SDK_INT >= 21 && isDeviceOwner(context)) {
            oneKeyActionMRoot(context, freeze, packages);
        } else {
            oneKeyActionRoot(context, freeze, packages);
        }
    }
    stopSelf();
    return super.onStartCommand(intent, flags, startId);
}
 
Example 20
Source File: WriteTag.java    From MifareClassicTool with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Initialize the layout and some member variables. If the Intent
 * contains {@link #EXTRA_DUMP} (and therefore was send from
 * {@link DumpEditor}), the write dump option will be adjusted
 * accordingly.
 */
// It is checked but the IDE don't get it.
@SuppressWarnings("unchecked")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_write_tag);

    mSectorTextBlock = findViewById(R.id.editTextWriteTagSector);
    mBlockTextBlock = findViewById(R.id.editTextWriteTagBlock);
    mDataText = findViewById(R.id.editTextWriteTagData);
    mSectorTextVB = findViewById(
            R.id.editTextWriteTagValueBlockSector);
    mBlockTextVB = findViewById(
            R.id.editTextWriteTagValueBlockBlock);
    mNewValueTextVB = findViewById(
            R.id.editTextWriteTagValueBlockValue);
    mIncreaseVB = findViewById(
            R.id.radioButtonWriteTagWriteValueBlockIncr);
    mStaticAC = findViewById(R.id.editTextWriteTagDumpStaticAC);
    mEnableStaticAC = findViewById(
            R.id.checkBoxWriteTagDumpStaticAC);
    mWriteManufBlock = findViewById(
            R.id.checkBoxWriteTagDumpWriteManuf);

    mWriteModeLayouts = new ArrayList<>();
    mWriteModeLayouts.add(findViewById(
            R.id.relativeLayoutWriteTagWriteBlock));
    mWriteModeLayouts.add(findViewById(R.id.linearLayoutWriteTagDump));
    mWriteModeLayouts.add(findViewById(
            R.id.linearLayoutWriteTagFactoryFormat));
    mWriteModeLayouts.add(findViewById(
            R.id.relativeLayoutWriteTagValueBlock));

    // Restore mDumpWithPos and the "write to manufacturer block"-state.
    if (savedInstanceState != null) {
        mWriteManufBlock.setChecked(
                savedInstanceState.getBoolean("write_manuf_block", false));
        Serializable s = savedInstanceState
                .getSerializable("dump_with_pos");
        if (s instanceof HashMap<?, ?>) {
            mDumpWithPos = (HashMap<Integer, HashMap<Integer, byte[]>>) s;
        }
    }

    Intent i = getIntent();
    if (i.hasExtra(EXTRA_DUMP)) {
        // Write dump directly from editor.
        mDumpFromEditor = i.getStringArrayExtra(EXTRA_DUMP);
        mWriteDumpFromEditor = true;
        // Show "Write Dump" option and disable other write options.
        RadioButton writeBlock = findViewById(
                R.id.radioButtonWriteTagWriteBlock);
        RadioButton factoryFormat = findViewById(
                R.id.radioButtonWriteTagFactoryFormat);
        RadioButton writeDump = findViewById(
                R.id.radioButtonWriteTagWriteDump);
        writeDump.performClick();
        writeBlock.setEnabled(false);
        factoryFormat.setEnabled(false);
        // Update button text.
        Button writeDumpButton = findViewById(
                R.id.buttonWriteTagDump);
        writeDumpButton.setText(R.string.action_write_dump);
    }
}