填充的EditText从数据库值 [英] Populate EditText with value from database

查看:219
本文介绍了填充的EditText从数据库值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我有一个EditText一个TextView。我想prepopulate的用的EditText的最后一个值输入,存储在SQLite数据库?

In my Android application I have a TextView with an EditText. I want to prepopulate the EditText with the last value entered, which is stored in the SQLite database?

推荐答案

这不应该这么辛苦,我想:

This should not be so hard I think:

public void onCreate(Bundle savedState) {
    EditText editText = (EditText) findViewById(R.id.my_edittext);
    String value = // Query your 'last value'.
    editText.setText(value);
}

如果您想了解更多关于SQLite数据库存储,读取文章的Andr​​oid文档中

If you want to learn more about SQLite database storage, read this article in Android document.

这篇关于填充的EditText从数据库值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆