I am using Firebase, and I am trying to show data from Firebase through my Android app. Yet, when I run the app, it crashes and logcat says "failed to bounce to type". I mimicked the properties of the JSON structure in a java class.
Here is the MainActivity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Firebase.setAndroidContext(this);
Firebase ref = new Firebase("https://fbandg.firebaseio.com/");
android.R.layout.simple_list_item_1, android.R.id.text1);
final TextView textbox = (TextView) findViewById(R.id.textbox);
Firebase.setAndroidContext(this);
ValueEventListener newCon = ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
fObject obj = dataSnapshot.getValue(fObject.class); //Line 49
textbox.setText(obj.toString());
}
@Override
public void onCancelled(FirebaseError firebaseError) {
}
});
Here is the Java class I created:
public class fObject
{
String newCond;
public String getCondition()
{
return newCond;
}
}
The errors produced are the following:
firebase.client.DataSnapshot.getValue(DataSnapshot.java:183)
com.example.elish_000.myfirstapp.MainActivity$1.onDataChange(MainActivity.java:49)