Reputation: 1667
I have an Intent
class to send multiple images to the email as an attached file. So all works fine. Only issue is that when no of images is more than 20 then it The Intent class takes time to open a particular mail client. So during that time i want to show progress bar to the user. So anyone help me to solve this out. My code for sending multiple images is shown below.
ArrayList<Uri> uris = new ArrayList<Uri>();
for(int i = 0; i< NoteManager.getSingletonObject().getNoteItemCount(); i++)
{
File imageFile = new File(m_ShareDir, NoteManager.getSingletonObject().getNote(i));
ContentValues values = new ContentValues(2);
values.put(MediaStore.Images.Media.MIME_TYPE, "image/png");
values.put(MediaStore.Images.Media.DATA, imageFile.getAbsolutePath());
Uri imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
uris.add(imageUri);
}
Intent intent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
intent.setType("image/png");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(intent, getResources().getString(R.string.share_send_text)));
Upvotes: 1
Views: 1266
Reputation: 5905
Try this. tutorial. And I think here is good example for you which show the progress item one by one.
Enjoy...
Upvotes: 0
Reputation: 1733
May it helps you
ProgressDialog pd = ProgressDialog.show(SetFrames.this,"Loading", "Please
Wait...",true);
new Thread() {
public void run() {
try {
//do your process
}catch(Exception e)
{
}
handler.sendEmptyMessage(0);
pd.dismiss();
}
}.start();
private Handler handler = new Handler() {
public void handleMessage(Message msg) {
}
};
Upvotes: 2