I apologize if this error has already appeared, but I was unable to resolve it in my app and the previous responses did not work.
I am developing a activity
that shows in a ListVew
the items registered in a specific table of the firebase.
The idea is to insert a filter in the future to search data within this table.
So far, the following error occurs when emulating (the app opens and executes 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 it should display 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 smartphone models are: Samgung E7 and Samsung One.