我注意到在较旧的设备上,一旦您执行了标准的共享意图(fb,twitter,电子邮件等),就会出现几秒钟的延迟,直到弹出实际的共享对话框。我想知道在等待此共享对话框出现时如何弹出进度对话框?
这是我的代码:
private void share(String subject,String body) {
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(android.content.Intent.EXTRA_SUBJECT, title);
share.putExtra(android.content.Intent.EXTRA_TEXT, body);
startActivity(Intent.createChooser(share, "Share via"));
}
Run Code Online (Sandbox Code Playgroud)
我想出了怎么做。调用startActivity(shareIntent)时,将调用方法中的onPause。因此,为了解决这个问题,我做了以下工作:
if(dialog.isShowing()){
dialog.dismiss();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1385 次 |
| 最近记录: |