import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.annotation.SuppressLint;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.os.Bundle;
import android.os.IBinder;
import android.preference.PreferenceManager;
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == ACTION_SELECT_CONTENT_FROM_APPS && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
for( int i = 0; i < data.getClipData().getItemCount(); i++){
Intent intent = new Intent();
intent.setData(data.getClipData().getItemAt(i).getUri());
for( int i = 0; i < data.getClipData().getItemCount(); i++){
Intent intent = new Intent();
intent.setData(data.getClipData().getItemAt(i).getUri());
} else if (item == 1) {
Intent action = new Intent(Intent.ACTION_GET_CONTENT);
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
} else if (item == 1) {
Intent action = new Intent(Intent.ACTION_GET_CONTENT);
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
- action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
+ //putExtra is only supported on api level 18+
+ if(Build.VERSION.SDK_INT >= 18) {
+ action.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
+ }
startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)),
ACTION_SELECT_CONTENT_FROM_APPS);
}
startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)),
ACTION_SELECT_CONTENT_FROM_APPS);
}