I am currently working on institute-level chat sharing apps on Android. I use Firebase as a cloud server. Currently, I have encountered Cannot Resolve Symbol error on DatabaseReference and FirebaseDatabase in the following line in MainActivity :
private DatabaseReference root = FirebaseDatabase.getInstance().getReference().getRoot();
I want chats to use Firebase. I know how to do this, as well as how to bind the keys and values ββof my Firebase database. I also know how to update keys and values ββfrom an Android device through Firebase Cloud.
But I can not resolve Cannot Resolve Symbol error . Below is the code for my MainActivity . I'm still in the early stages of creating this application.
package com.ranatalha.realtimechat; import android.content.DialogInterface; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private Button buttonAddRoom; private EditText editTextAddaChatRoom; private ListView listViewChatRooms; private ArrayAdapter<String> arrayAdapter; private ArrayList<String> list_of_rooms = new ArrayList<>(); private String Entered_Username; private DatabaseReference root = FirebaseDatabase.getInstance().getReference().getRoot(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); buttonAddRoom = (Button) findViewById(R.id.buttonAddRoom); editTextAddaChatRoom = (EditText) findViewById(R.id.editTextAddaChatRoom); listViewChatRooms = (ListView) findViewById(R.id.listViewChatRooms);
android firebase firebase-database
Rana Talha Tariq
source share