Last active
September 21, 2017 04:02
-
-
Save shahbazahmed1269/9b4a2b727469997cfe1b27ec6425a907 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
mViewModel = ViewModelProviders.of(this).get(ListIssuesViewModel.class); | |
setupView(); | |
// Handle changes emitted by LiveData | |
mViewModel.getRes().observe(this, apiResponse -> { | |
if (apiResponse.getError() != null) { | |
handleError(apiResponse.getError()); | |
} else { | |
handleResponse(apiResponse.getIssues()); | |
} | |
}); | |
} | |
// Rest of the code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment