【发布时间】:2019-03-28 21:43:46
【问题描述】:
我想要什么:从 gmail 附件中的 json 获取数据。
说明: 打开Gmail,点击附件是json文件。我需要处理的 Json 文件句柄数据。
在我声明的清单中
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="application/json"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
接下来我用
Intent intent = getIntent();
if(intent.getAction().equals(Intent.ACTION_VIEW)){
intent.getData <- I suppose from here i can get my infomation
}
但是 intent.getData 只返回 Uri,而且我读到有人我必须使用 ContentResolver、InputStream 和其他东西来例如将我的数据从 json 写入字符串。如果有人可以通过示例解释它的工作原理,我将不胜感激。
【问题讨论】:
标签: android json android-intent gmail attachment