【发布时间】:2014-05-11 23:21:11
【问题描述】:
我从其他应用读取接收数据: http://developer.android.com/guide/topics/manifest/application-element.html
我将 android.intent.action.SEND 替换为 android.intent.action.VIEW
但是当我的应用程序长按主页按钮作为随身听时,我的应用程序没有与文件管理器分开。
我需要使用随身听。请帮帮我。
在后台运行时,我的应用不会像使用 Walkman 那样与文件管理器拆分。
这是我的代码 sn-p:
Intent externalIntent = getIntent(); String action = externalIntent.getAction();
String type = externalIntent.getType();
Uri sendUri = externalIntent.getData(); Toast.makeText(this, "Type: " + type, Toast.LENGTH_SHORT).show();
Toast.makeText(this, sendUri.getPath(), Toast.LENGTH_SHORT).show();
Intent mainIntent = new Intent(this, MainActivity.class);
String sendType = Util.AUDIO; if (type.startsWith("video")) { sendType = Util.VIDEO; }
mainIntent.putExtra("path", sendUri.getPath()); mainIntent.putExtra("type", sendType);
startActivity(mainIntent);
finish();
【问题讨论】:
-
问题不清楚。您想在单击音频文件时将您的应用添加到建议列表中吗?
-
能贴出你用过的代码吗?
-
删除最后一行“finish();”..因为它关闭了您新创建的活动..并重新运行应用程序..您得到的错误/输出是什么什么时候运行代码?
-
当您的应用程序从其他应用程序接收数据时(按照 Google 的说明),那么您的应用程序就离不开文件管理器
标签: android android-intent intentfilter