当前位置: 首页>>代码示例>>Java>>正文


Java EMFileMessageBody.getLocalUrl方法代码示例

本文整理汇总了Java中com.hyphenate.chat.EMFileMessageBody.getLocalUrl方法的典型用法代码示例。如果您正苦于以下问题:Java EMFileMessageBody.getLocalUrl方法的具体用法?Java EMFileMessageBody.getLocalUrl怎么用?Java EMFileMessageBody.getLocalUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hyphenate.chat.EMFileMessageBody的用法示例。


在下文中一共展示了EMFileMessageBody.getLocalUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.hyphenate.chat.EMFileMessageBody; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.ease_activity_show_file);
	progressBar = (ProgressBar) findViewById(R.id.progressBar);

	final EMFileMessageBody messageBody = getIntent().getParcelableExtra("msgbody");
	file = new File(messageBody.getLocalUrl());
	//set head map
	final Map<String, String> maps = new HashMap<String, String>();
	if (!TextUtils.isEmpty(messageBody.getSecret())) {
		maps.put("share-secret", messageBody.getSecret());
	}
	
	//下载文件
	EMClient.getInstance().chatManager().downloadFile(messageBody.getRemoteUrl(), messageBody.getLocalUrl(), maps,
               new EMCallBack() {
                   
                   @Override
                   public void onSuccess() {
                       runOnUiThread(new Runnable() {
                           public void run() {
                               FileUtils.openFile(file, EaseShowNormalFileActivity.this);
                               finish();
                           }
                       });
                   }
                   
                   @Override
                   public void onProgress(final int progress,String status) {
                       runOnUiThread(new Runnable() {
                           public void run() {
                               progressBar.setProgress(progress);
                           }
                       });
                   }
                   
                   @Override
                   public void onError(int error, final String msg) {
                       runOnUiThread(new Runnable() {
                           public void run() {
                               if(file != null && file.exists()&&file.isFile())
                                   file.delete();
                               String str4 = getResources().getString(R.string.Failed_to_download_file);
                               Toast.makeText(EaseShowNormalFileActivity.this, str4+msg, Toast.LENGTH_SHORT).show();
                               finish();
                           }
                       });
                   }
               });
	
}
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:53,代码来源:EaseShowNormalFileActivity.java

示例2: onCreate

import com.hyphenate.chat.EMFileMessageBody; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.ease_activity_show_file);
	progressBar = (ProgressBar) findViewById(R.id.progressBar);

	final EMFileMessageBody messageBody = getIntent().getParcelableExtra("msgbody");
	file = new File(messageBody.getLocalUrl());
	//set head map
	final Map<String, String> maps = new HashMap<String, String>();
	if (!TextUtils.isEmpty(messageBody.getSecret())) {
		maps.put("share-secret", messageBody.getSecret());
	}
	
	//download file
	EMClient.getInstance().chatManager().downloadFile(messageBody.getRemoteUrl(), messageBody.getLocalUrl(), maps,
               new EMCallBack() {
                   
                   @Override
                   public void onSuccess() {
                       runOnUiThread(new Runnable() {
                           public void run() {
                               FileUtils.openFile(file, EaseShowNormalFileActivity.this);
                               finish();
                           }
                       });
                   }
                   
                   @Override
                   public void onProgress(final int progress,String status) {
                       runOnUiThread(new Runnable() {
                           public void run() {
                               progressBar.setProgress(progress);
                           }
                       });
                   }
                   
                   @Override
                   public void onError(int error, final String msg) {
                       runOnUiThread(new Runnable() {
                           public void run() {
                               if(file != null && file.exists()&&file.isFile())
                                   file.delete();
                               String str4 = getResources().getString(R.string.Failed_to_download_file);
                               Toast.makeText(EaseShowNormalFileActivity.this, str4+msg, Toast.LENGTH_SHORT).show();
                               finish();
                           }
                       });
                   }
               });
	
}
 
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:53,代码来源:EaseShowNormalFileActivity.java


注:本文中的com.hyphenate.chat.EMFileMessageBody.getLocalUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。