Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot get Android app to connect to Firebase
    primarykey
    data
    text
    <p>So I've tried this 3 times, and have had no luck successfully making an Android application that will communicate with Firebase. As simple as <a href="https://www.firebase.com/docs/java-quickstart.html" rel="nofollow noreferrer">the tutorial</a> makes it, I can't help but think either I or it (most likely the former) is missing something.</p> <p>The sample app I'm making simply holds a TextView that should be updated with any changes to my Firebase at <a href="https://dummy-firebase.firebaseio.com/" rel="nofollow noreferrer">https://dummy-firebase.firebaseio.com/</a> (since I can't make a public Firebase, if you'd like you can paste the URL of your own firebase to test the code). Here's a snapshot of what's on the Firebase:</p> <p><img src="https://i.stack.imgur.com/pA9Jl.png" alt="Firebase snapshot"></p> <p>Here's the onCreate of my only Activity:</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Firebase f = new Firebase("https://dummy-firebase.firebaseio.com"); f.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot arg0) { TextView textViewSample = (TextView) findViewById(R.id.sampleTextView); textViewSample.setText(arg0.getValue(String.class)); } @Override public void onCancelled() { // TODO Auto-generated method stub } }); } </code></pre> <p>And here's the only XML file, activity_main.xml:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/sampleTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; </code></pre> <p></p> <p>And here's a picture of the Manifest so you can clearly see the INTERNET permission:</p> <p><img src="https://i.stack.imgur.com/7Nc1p.png" alt="enter image description here"></p> <p>Now as I change the data on the Firebase from my browser, I believe the data in the TextView should update. This isn't happening, and I have unsuccessfully tried the to put data using EditTexts and Buttons in the previous Firebase Android project attempts. </p> <p>Thanks in advance for taking the time to look over this. Because of how simple Firebase seems to set up (and was for the Javascript version) I'm truly stumped as to what I'm doing wrong!</p> <p>Thanks!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload