title: Retrieving data from Firebase database to webView in Android
body: <p>I am building an application with <strong>webView</strong> and <strong>Firebase</strong> as database, I have implemented both correctly but the problem is that my webView is <strong>not retrieving</strong> any data from Firebase database and is showing blank when I open application, I have checked the webView by adding <strong>URL</strong> directly and it shows web page but it does not show anything when I use it with Firebase, please help to sort this thing out.</p>
  
  <blockquote>
    <p>I am using Android Studio</p>
  </blockquote>
  
  <p><strong>webView class file:</strong></p>
  
  <pre><code>public class webViewNews extends AppCompatActivity {
  
      private WebView webviewthis;
      private RecyclerView webVieRes;
      private DatabaseReference mdataRef;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.webview_page);
          mdataRef = FirebaseDatabase.getInstance().getReference().child("weber");
          webviewthis = (WebView)findViewById(R.id.webView_news);
          webviewthis.setWebViewClient(new WebViewClient());
          webviewthis.getSettings().setJavaScriptEnabled(true);
          webviewthis.getSettings().setLoadsImagesAutomatically(true);
          mdataRef.addListenerForSingleValueEvent(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
               post2web webView = dataSnapshot.getValue(post2web.class);
                  webviewthis.loadUrl(webView);
              }
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
  
      }
  }
  </code></pre>
  
  <p><strong>webView xml file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;WebView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/webView_news"/&gt;
  
    &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>getter and setter class file:</strong></p>
  
  <pre><code>public class post2web {
      private String webViewPost;
  
  
      public post2web(){
      }
  
      public post2web(String webViewPost) {
          this.webViewPost = webViewPost;
      }
  
  
      public String getWebViewPost() {
          return webViewPost;
      }
  
      public void setWebViewPost(String webViewPost) {
          this.webViewPost = webViewPost;
      }
  }
  </code></pre>
  
  <p><strong>Firebase rules:</strong>
  <a href="https://i.stack.imgur.com/HLqL3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HLqL3.png" alt="enter image description here"></a></p>
  
  <p><strong>Firebase Database structure for webView</strong></p>
  
  <p><a href="https://i.stack.imgur.com/N1Tlr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N1Tlr.png" alt="enter image description here"></a></p>