Пример #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    findViewById(R.id.scanButton)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                openGallery();
              }
            });
    progressView = findViewById(R.id.progressBar);
  }
Пример #2
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (requestCode != SELECT_PICTURE_REQUEST || resultCode != RESULT_OK) {
      return;
    }

    Uri imageUri = intent.getData();

    if (imageUri == null) {
      return;
    }

    new ProcessDocumentTask(imageUri).execute();
    progressView.setVisibility(View.VISIBLE);
  }