If you open an FileChooser using Intent.ACTION_GET_CONTENT
and select a huge amount of files e.g. 2500, a TransactionTooLargeException
will be thrown and then the process is killed without resuming in onActivityResult
:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(CATEGORY_OPENABLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent = Intent.createChooser(intent, "Foo");
startActivityForResult(intent, 121);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// logic stuff
}
}
How is it possible to let the user decide how many files to select without destroying the app?