android - json数据到textview

标签 android json

我正在从数据库中提取数据,并且使用 json。我应该使用什么方法才能将它们打印在我的 xml 文件的 texview 项上,因为我有点困惑。

最佳答案

如果您已将 JSON 包装为 java 对象,那么您可以执行此操作以获取 Actvity 中的 TextView 并设置文本:

TextView text = (TextView) findViewById(R.id.myTextView);
text.setText("My JSON text");

myTextView 应该是 XML 布局中 TextView 的 ID。

关于android - json数据到textview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8758496/

相关文章:

javascript - 随机错误 "Unexpected token in JSON"

json - Cassandra CQL3 : JSON or UDT

java - 在 OneSignal 通知 Android 中编辑消息内容

c# - 根据节点名称拆分大型 JSON 的通用代码

javascript - 在 Angular Controller 中操作 JSON

java - 使用位置回调获取位置更新

android - OnSuccess 没有被命中,获取不到图片下载地址,fire base

android - Cordova 3.4 中的 requestFileSystem 失败并出现 "Class not found"错误

android - 根据属性选择元素-缺少一些元素

android - GPL和安卓数字签名