maybe I can get help here. I'm working on an Android app in Java and try to pick a .csv file to import some data:
public void onButtonImportClick(View view) {
Log.d(TAG, "onButtonImportClick");
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/*");
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[] { "text/csv", "text/plain" });
someActivityResultLauncher.launch(intent);
}
The picker shows files but all are greyed out, besides the .txt files. Actually I expected to get .csv and .txt files. Obviously something is not correct with MIME type setting.
Any ideas or suggestions?
Use opencsv for read CSV file.
Add below gradle into
gradlefile.Implement below function for read csv file