Question: I created this method to handle 2 different way of creating alert dialog, depending on internet status. Do you know a better way to get the same result? Using .equals() on strings in if-else block do not seem a best-practices way... Am i right?

```
public void noInternetAlertDialog(String errorMsg) {
    String title = null;
    String msg = null;

    if (errorMsg.equals("none")) {
        title = "Connection failded";
        msg = "Please check internet connection";
    } else if (errorMsg.equals("slow")) {
        title = "Connection timeout";
        msg = "Connection is slow";
    }

    AlertDialog.Builder builder;
    builder = new AlertDialog.Builder(Main.this);
    builder.setCancelable(false);
    builder.setTitle(title);
    builder.setMessage(msg);

    builder.setPositiveButton("Retry", new DialogInterface.OnClickListener(){
        @Override
        public void onClick(DialogInterface dialog, int which)
        {
            dialog.dismiss();
            downloadDialog();
        }
    });

    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            finish();
        }
    });         
    AlertDialog dialog = builder.create();
    dialog.show();
}

```

Answer: 
You can use angular.filters (<https://github.com/a8m/angular-filter>) to group your list by date please see demo below

```js
var app = angular.module('app', ['angular.filter']);

app.controller('homeCtrl', function($scope) {

  $scope.data = {
    "error": false,
    "events": [{
      "id": 1,
      "title": "First entry",
      "date": "2014-11-04"
    }, {
      "id": 2,
      "title": "Second entry",
      "date": "2014-11-04"
    }, {
      "id": 3,
      "title": "Third entry",
      "date": "2014-11-05"
    }, {
      "id": 4,
      "title": "Fourth entry",
      "date": "2014-11-06"
    }, {
      "id": 5,
      "title": "Fifth entry",
      "date": "2014-11-06"
    }]
  }

});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/angular-filter/0.4.9/angular-filter.min.js"></script>

<div ng-app="app">
  <div ng-controller="homeCtrl">

    <ion-list ng-repeat="(key, value) in data.events | groupBy: 'date'">
      <div class="item item-divider">
        <h1> {{key}}</h1>
      </div>

      <a class="item item-thumbnail-left" href="#/app/event/{{event.id}}" ng-repeat="event in value">
        <img src="media/thumbnails/{{event.id}}.jpg">
        <h3>{{event.title}}</h3>
      </a>
    </ion-list>

  </div>
```
I solved this in another SO question here, [Ionic Dynamic List Divider](https://stackoverflow.com/questions/26694073/ionic-dynamic-list-divider/26695214?noredirect=1). Basically you can modify the list (in the controller, not the source of course) to include the dates. In your view, you notice this and render them as dividers.