从数据库获取数据并将其设置为edittext [英] fetching data from database and set it on edittext

查看:509
本文介绍了从数据库获取数据并将其设置为edittext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的应用程序做一个注册页面。为此,我需要将注册详细信息插入到sqlite数据库。一旦注册完成,edittext字段应显示这些细节从数据库和提交按钮和文本字段应禁用从第二次注册停止。任何人都建议合适的方式?

I am doing a registration page for my application.For this I need to insert the registration details in to sqlite DB.Once the registration is done,the edittext fields should display those details fetching it from database and the submit button and text fields should be disabled to stop from a second time registration.Can anyone suggest the suitable way?

推荐答案

以下链接 Android SQLite

您必须将值存储在数组列表中,并从数据库检索,并将值设置为编辑文本

You have to store the value in an arraylist and which is retrieved from database and set the value to the edit text as

// myarraylist is the arraylist which contains 
// the data retrieved from database
editText.setText(myarraylist.get(0)); 

检索数据后,必须检查 editText的条件。 getText()。toString()长度大于零,您不应允许他们使用以下

After the data is retrieved, you have to check the condition whether editText.getText().toString() length is greater then zero you should not allow them to edit the text in editText by using following

  editText.setFocusable(false);

这篇关于从数据库获取数据并将其设置为edittext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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