I have a simple POJO class here:
@IgnoreExtraProperties
public class Poll {
private String Question;
private String Image_URL;
public Poll() {
}
public Poll(String Question, String Image_URL){
this.Question = Question;
this.Image_URL = Image_URL;
}
public String getQuestion() {
return Question;
}
public void setQuestion(String question) {
Question = question;
}
public String getImage_URL() {
return Image_URL;
}
public void setImage_URL(String image_URL) {
Image_URL = image_URL;
}
}
I am trying to write to Firebase via the following method and nothing is happening at all in the Firebase database, so it isn't writing or recognizing the reference. It may have to do with my Firebase/POJO mapping but I can't identify the cause:
mSubmitPollCreation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// //TODO: Need to determine if this is proper epoch - i.e. does it account for time zones
// Calendar c = Calendar.getInstance();
// final String epochTime = String.valueOf(c.getTimeInMillis());
// mEpochRef = mBaseRef.child("Poll").child(epochTime);
//TODO: Need to check if poll requirements are added, i.e. Question, Answer, ......
//check if image has been loaded first
if (resultImageURL != null){
Map<String, Object> imageURL = new HashMap<String, Object>();
imageURL.put("Image_URL", resultImageURL);
// mEpochRef.updateChildren(imageURL);
} else {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.no_image_selected),Toast.LENGTH_LONG).show();
return;
}
Poll poll = new Poll(mCreatePollQuestion.getText().toString(), resultImageURL);
mBaseRef = FirebaseDatabase.getInstance().getReference();
mBaseRef.child("Polls").push().setValue(poll);
}