我想设置一个带有字符串数组的{
"companies": [{
"name": "Soft",
"position": "Developer",
"location": "NY",
"start": 1462060800,
"end": 1470009600,
"description" : ""},
{
"name": "Xpert",
"position": "Developer",
"location": "London",
"start": 1456790400,
"end": 1462060800,
"description" : ""},
{
"name": "AXinformation",
"position": "Developer",
"location": "Paris",
"start": 1388534400,
"end": 1456790400,
"description" : " "},
.....
.....
.....
,该数组数据来自public void onCallingFireBaseExperience() {
final FirebaseDatabase database = FirebaseDatabase.getInstance();
final DatabaseReference myRef = database.getReference("companies");
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot dataSnapshot1: dataSnapshot.getChildren()){
Log.d(Constans.LOG, dataSnapshot1.child("name").getValue().toString())
}
}
@Override
public void onCancelled(DatabaseError error) {
Log.d(Constans.LOG, "Failed to read value.", error.toException());
}
});
}
数据库并使用AutoCompleteTextView
。之后,JSON格式的数据被解析为字符串数组,其名称为MySQL
。源字符串存储在字符串数组中。我使用下面的代码来设置适配器。
AsyncTask
我没有收到任何错误消息,但是当我尝试输入前两个字符时,会使用提交按钮打开一个新界面。我无法获得自动完成的建议。