title: get unread Gmail number
body: <p>it's me again</p>
  
  <p>This time I'm trying to get the unread email number for gmail and display it on screen.</p>
  
  <p>I'm following the  Gmail Public Labels API and get this code </p>
  
  <pre><code>protected int getGmail(Context context) {
  
      AccountManager.get(context).getAccountsByTypeAndFeatures(ACCOUNT_TYPE_GOOGLE, FEATURES_MAIL,
              new AccountManagerCallback() {
                  @Override
                  public void run(AccountManagerFuture future) {
                      Account[] accounts = null;
                      try {
                          accounts = future.getResult();//error here
                          if (accounts != null &amp;&amp; accounts.length &gt; 0) {
                              String selectedAccount = accounts[0].name;
                              queryLabels(selectedAccount);
                          }
  
                      } catch (OperationCanceledException oce) {
                          // TODO: handle exception
                      } catch (IOException ioe) {
                          // TODO: handle exception
                      } catch (AuthenticatorException ae) {
                          // TODO: handle exception
                      }
                  }
              }, null /* handler */);
  </code></pre>
  
  <p>There is this error:cannot convert from Object to Account[]</p>
  
  <p>The Question is : What do I need to do to remove this error while still getting the results ?</p>