Firebase Android关闭

时间:2018-10-27 16:52:30

标签: android firebase google-cloud-firestore

我启动我的Google Firestore应用程序时将其关闭,但在Android Studio中没有错误。 请帮忙。

private DocumentReference mDocFef = FirebaseFirestore.getInstance().document("news/1");
public TextView News1TextView;

@Override
protected void onStart() {
    super.onStart();
    mDocFef.addSnapshotListener(new EventListener<DocumentSnapshot>() {
        @Override
        public void onEvent(@Nullable DocumentSnapshot documentSnapshot, @Nullable FirebaseFirestoreException e) {
                String news1TitleText = documentSnapshot.getString("Title");
                String news1ContentText = documentSnapshot.getString("Article");

                News1TextView.setText(news1TitleText + " " + news1ContentText);
        }
    });
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final TextView News1TextView = (TextView) findViewById(R.id.news1Title);
    News1TextView.setText("123456789");
}

0 个答案:

没有答案