Permalink
Browse files

Handled No Internet condition

  • Loading branch information...
1 parent 7af56e8 commit b46b9d7922c25dc0d93e00c0fb884d458221e89d @vivekrk committed Dec 26, 2011
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/com/company/tweeter/TimelineActivity.java
@@ -103,11 +103,19 @@ public void onCreate(Bundle savedInstanceState) {
initializeUI();
updateTimelineUI(TwitterAccount.TIMELINE);
- // new GetStatuses().execute(newPages);
- new PollForData().execute();
+ if (ImageDownloader.isNetworkConnected(getApplicationContext())) {
+ // new GetStatuses().execute(newPages);
+ new PollForData().execute();
+ } else {
+ Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_SHORT).show();
+ }
} else {
try {
- login();
+ if (ImageDownloader.isNetworkConnected(getApplicationContext())) {
+ login();
+ } else {
+ Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_SHORT).show();
+ }
} catch (TwitterException e) {
Log.d(Constants.TAG, "Login failed");
}

0 comments on commit b46b9d7

Please sign in to comment.