我是使用Android Studio的新程序员 我想构建一个人,当他点击按钮时记录数据。
但发现一些问题
我现在做了什么
private static final int GALLREQ = 1;
private EditText name1,name2,name3,name4,name5,name6,name7,name8,name9,name10,name11;
private StorageReference storageReference = null;
private DatabaseReference databaseReference;
private FirebaseDatabase firebaseDatabase;
private Button button;
private FirebaseAuth firebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
name1 = (EditText)findViewById(R.id.editText1N);
name2 = (EditText)findViewById(R.id.editTextNu);
name3 = (EditText)findViewById(R.id.editTextT);
name4 = (EditText)findViewById(R.id.editText3);
name5 = (EditText)findViewById(R.id.editText4);
name6 = (EditText)findViewById(R.id.editText5);
name7 = (EditText)findViewById(R.id.editText7);
name8 = (EditText)findViewById(R.id.editText8);
name9 = (EditText)findViewById(R.id.editText9);
name10 = (EditText)findViewById(R.id.editText10);
name11 = (EditText)findViewById(R.id.editText11);
button = (Button) findViewById(R.id.button4);
databaseReference = FirebaseDatabase.getInstance().getReference("Item");
storageReference = FirebaseStorage.getInstance().getReference("Item");
firebaseAuth = FirebaseAuth.getInstance();
}
public void Ait(View view) {
final String name_text = name1.getText().toString().trim();
final String phone_text = name2.getText().toString().trim();
final String altalp_text = name3.getText().toString().trim();
final String ma_text = name4.getText().toString().trim();
final String ma1_text = name5.getText().toString().trim();
final String ma2_text = name6.getText().toString().trim();
final String ma3_text = name7.getText().toString().trim();
final String ma4_text = name8.getText().toString().trim();
final String ma5_text = name9.getText().toString().trim();
final String ma6_text = name10.getText().toString().trim();
final String ma7_text = name11.getText().toString().trim();
final DatabaseReference newpost = databaseReference.push();
newpost.child("name").setValue(name_text);
newpost.child("phone").setValue(phone_text);
newpost.child("altalp").setValue(altalp_text);
newpost.child("ma_text").setValue(ma_text);
newpost.child("ma1_text").setValue(ma1_text);
newpost.child("ma2_text").setValue(ma2_text);
newpost.child("ma3_text").setValue(ma3_text);
newpost.child("ma4_text").setValue(ma4_text);
newpost.child("ma5_text").setValue(ma5_text);
newpost.child("ma6_text").setValue(ma6_text);
newpost.child("ma7_text").setValue(ma7_text);
}
}
现在我将我的数据发送到消防基地..我想当我正在寻找有关某人的数据时,我可以通过名单或电话号码以及列表视图或任何事物中的曝光找到它??
我希望我的想法能够得到帮助..