title: android twitter 4j integration get tweet entities
body: <p>I am working on  twitter integration with android using Twiitter4j. I am trying to fetch Home timelines and its working fine. But when i am looking to get urls included in the tweets there is no functions. Is there a functon to get tweet entites like urls etc.</p>
  
  <p>Here is the code</p>
  
  <pre><code>cb = new ConfigurationBuilder();
      cb.setDebugEnabled(true).setOAuthConsumerKey(Constants.CONSUMER_KEY)
              .setOAuthConsumerSecret(Constants.CONSUMER_SECRET)
              .setOAuthAccessToken(accessToken).setOAuthAccessTokenSecret(
                      accessSecret);
  
      try {
          TwitterFactory factory = new TwitterFactory(cb.build());
          // gets Twitter instance with default credentials
          Twitter twitter = factory.getInstance();
          User user = twitter.verifyCredentials();
          List&lt;Status&gt; statuses = twitter.getHomeTimeline();
          System.out.println("Showing @" + user.getScreenName() + "'s home timeline.");
          for (Status status : statuses) {
  
              System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText() + "--"+status.getURLs()+ "--"+status.getURLEntities());
          }
      } catch (TwitterException te) {
          te.printStackTrace();
          System.out.println("Failed to get timeline: " + te.getMessage());
          System.exit(-1);
      }
  </code></pre>
  
  <hr>
  
  <p>Works well with Sony's code and after that i have moved my code to async task and it shows some errors</p>
  
  <p>Here is my edited code</p>
  
  <pre><code>        protected String doInBackground(Void... args) {
          String response = null;
  
          try {
              TwitterFactory factory = new TwitterFactory(cb.build());
              // gets Twitter instance with default credentials
              Twitter twitter = factory.getInstance();
              User user = twitter.verifyCredentials();
              ResponseList&lt;Status&gt; statuses = twitter.getHomeTimeline();
  
  
              System.out.println("Showing @" + user.getScreenName() + "'s home timeline.");
              for (Status status : statuses) {
  
                  System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText() + "--"+status.getUser().getProfileImageURL());
                  URLEntity[] uent = status.getURLEntities();
                  if (uent != null) {
                      for (int k = 0; k &lt; uent.length; k++) {
                          Log.i("URL Entity", "Dp Url " + uent[k].getDisplayURL()
                                  + " URL " + uent[k].getURL() + " start "
                                  + uent[k].getStart() + " end "
                                  + uent[k].getEnd());
                      }
  }
              }
  
          } catch (TwitterException te) {
              te.printStackTrace();
              System.out.println("Failed to get timeline: " + te.getMessage());
              System.exit(-1);
          }
          return response;
      }
  </code></pre>