title: How to read a text file from url in android
body: <p>I wanna to write an app that need to recive some text from server 
  this is my code :   </p>
  
  <pre><code>String db = ""
  new Thread(new Runnable() {
              @Override
              public void run() {
  
                  try {
                      // Create a URL for the desired page
                      URL url = new URL("http://chemvaaj.xzn.ir/test/words.txt");
  
                      // Read all the text returned by the server
                      BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                      String str;
                      while ((str = in.readLine()) != null) {
                          // str is one line of text; readLine() strips the newline character(s)
                          db+=str;
                      }
                      in.close();
                  } catch (MalformedURLException e) {
                  } catch (IOException e) {
                  }
  
              }
          }).start();
  
          searchEditText.setText(dbd);
  </code></pre>
  
  <p>it seems right but the variable db is stil "" in the end .</p>