0
I apologize if this error has already appeared, but I could not solve it in my app and the previous answers did not work.
I’m developing a activity
show in a ListVew
items registered in a specific firebase table.
The idea is future, insert a filter to be able to search data within this table.
So far, the following error occurs while emulating (the app opens and runs, but does not show my ListView
):
D/Abslistview: Get Motionrecognitionmanager E/Motionrecognitionmanager: mSContextService = null motionService = com.samsung.android.motion.Imotionrecognitionservice$Stub$Proxy@3a9482a5 D/Secwifidisplayutil: Metadata value : None
My Bakery Activity (where to display the ListView
):
package e.servidor.myapplication.Produtos;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.firebase.client.ChildEventListener;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import com.google.firebase.FirebaseApp;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.FirebaseDatabase;
import java.util.ArrayList;
import e.servidor.myapplication.R;
public class Padaria extends AppCompatActivity {
Firebase objetoRef;
ListView minhaListPadaria;
ArrayList<String> minhaLVpadaria = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_padaria );
Firebase.setAndroidContext( this );
minhaListPadaria = (ListView) findViewById( R.id.LV_padaria );
objetoRef = new Firebase( "https://console.firebase.google.com/u/0/project/projeto-eb1cf/database/projeto-eb1cf/data" );
Firebase novaRef = objetoRef.child( "padaria" );
final ArrayAdapter<String> adaptador = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, minhaLVpadaria );
minhaListPadaria.setAdapter( adaptador );
novaRef.addChildEventListener( new ChildEventListener() {
@Override
public void onChildAdded(com.firebase.client.DataSnapshot dataSnapshot, String s) {
String message = dataSnapshot.getValue( String.class );
minhaLVpadaria.add( message );
adaptador.notifyDataSetChanged();
}
@Override
public void onChildChanged(com.firebase.client.DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(com.firebase.client.DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(com.firebase.client.DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(FirebaseError firebaseError) {
}
});
}
}
Can you help me? The models of smartphones are: Samgung E7 and Samsung One.
What version of Firebase are you using?
– Rosário Pereira Fernandes
You seem to have the wrong URL. It should be:
objetoRef = new Firebase( "https://projeto-eb1cf.firebaseio.com" );
– Rosário Pereira Fernandes
Hello. The command in the above structure appears permission denied. With the link I placed, the connection with the table occurs but returns the error (which I believe to be the stack).
– Letícia Dickel
Go to your Firebase console, open your database. You’ll see a tab called "Rules". Try placing public Rules (
read: true
andwrite: true
)– Rosário Pereira Fernandes
This has already been tested. Unfortunately, Rules already has these permissions.
– Letícia Dickel