{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/RSS_2/pulls/comments/57553527","id":57553527,"diff_hunk":"@@ -87,4 +112,166 @@ public void onClick(View view) {\n         NavigationView mNavigationView = (NavigationView) findViewById(R.id.nav_view);\n         mNavigationView.setNavigationItemSelectedListener(this);\n     }\n+\n+    private void getData() {\n+        mDatabase = new Database(this);\n+        //  Open connect mDatabase\n+        mSqLiteDatabase = connectDataBase();\n+        if (mSqLiteDatabase != null) //  if mDatabase !+ null\n+            //  Insert new mDatabase\n+            mDatabase.insertDataBase(mSqLiteDatabase);\n+        mReadRssAsyncTask = new ReadRssAsyncTask(this);\n+        if (checkInternetConnection()) { // Check connection Internet\n+            LinkUrl linkUrl = new LinkUrl();\n+            mUrlArrayList = linkUrl.getUrlArrayList();\n+            mReadRssAsyncTask.execute(mUrlArrayList);\n+            mReadRssAsyncTask.setUpdate(new ReadRssAsyncTask.UpdateData() {\n+                @Override\n+                public boolean updateData(boolean update) {\n+                    if (update) {\n+                        mInformation = mReadRssAsyncTask.getInformation();\n+                        setFragmentMain();\n+                        mListPosts = mReadRssAsyncTask.getListPosts();\n+//                        updateInformation(mInformation);\n+//                        updatePost(mListPosts);\n+                    }\n+                    return false;\n+                }\n+            });\n+        }\n+    }\n+\n+    public SQLiteDatabase connectDataBase() {\n+        SQLiteDatabase Database = null;\n+        try {\n+            /**\n+             * Mo CSDL neu ko co thi tao moi\n+             */\n+            Database = openOrCreateDatabase(NAME_DATABASE, SQLiteDatabase.CREATE_IF_NECESSARY, null);\n+        } catch (Exception ex) {\n+        }\n+        return Database;\n+    }\n+\n+    private boolean checkInternetConnection() {\n+        int TypeWifi = ConnectivityManager.TYPE_WIFI;\n+        int TypeMobile = ConnectivityManager.TYPE_MOBILE;\n+        // get Connectivity Manager object to check connection\n+        ConnectivityManager connec = (ConnectivityManager) getSystemService(getBaseContext().CONNECTIVITY_SERVICE);\n+        // Check for network connections\n+        if (connec.getNetworkInfo(TypeMobile).getState() == android.net.NetworkInfo.State.CONNECTED ||\n+                connec.getNetworkInfo(TypeMobile).getState() == android.net.NetworkInfo.State.CONNECTING ||\n+                connec.getNetworkInfo(TypeWifi).getState() == android.net.NetworkInfo.State.CONNECTING ||\n+                connec.getNetworkInfo(TypeWifi).getState() == android.net.NetworkInfo.State.CONNECTED) {\n+            return true;\n+        } else if (\n+                connec.getNetworkInfo(TypeMobile).getState() == android.net.NetworkInfo.State.DISCONNECTED ||\n+                        connec.getNetworkInfo(TypeWifi).getState() == android.net.NetworkInfo.State.DISCONNECTED) {\n+            Toast.makeText(this, \" Not Connected \", Toast.LENGTH_LONG).show();\n+            return false;\n+        }\n+        return false;\n+    }\n+\n+    private void setFragmentMain() {","path":"app/src/main/java/framgia/vn/readrss/activity/MainActivity.java","position":127,"original_position":127,"commit_id":"f934da18452837dc6086e02e17a95428d63cdcec","original_commit_id":"f934da18452837dc6086e02e17a95428d63cdcec","user":{"login":"cong91","id":2290242,"avatar_url":"https://avatars.githubusercontent.com/u/2290242?v=3","gravatar_id":"","url":"https://api.github.com/users/cong91","html_url":"https://github.com/cong91","followers_url":"https://api.github.com/users/cong91/followers","following_url":"https://api.github.com/users/cong91/following{/other_user}","gists_url":"https://api.github.com/users/cong91/gists{/gist_id}","starred_url":"https://api.github.com/users/cong91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cong91/subscriptions","organizations_url":"https://api.github.com/users/cong91/orgs","repos_url":"https://api.github.com/users/cong91/repos","events_url":"https://api.github.com/users/cong91/events{/privacy}","received_events_url":"https://api.github.com/users/cong91/received_events","type":"User","site_admin":false},"body":"Sau này nếu có thêm FragmentSub nữa thì lại tạo thêm ra hàm setFragmentSub và có nguyên đoạn code ở dưới hả ông . ","created_at":"2016-03-28T08:13:27Z","updated_at":"2016-03-28T08:13:27Z","html_url":"https://github.com/framgia/RSS_2/pull/7#discussion_r57553527","pull_request_url":"https://api.github.com/repos/framgia/RSS_2/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/framgia/RSS_2/pulls/comments/57553527"},"html":{"href":"https://github.com/framgia/RSS_2/pull/7#discussion_r57553527"},"pull_request":{"href":"https://api.github.com/repos/framgia/RSS_2/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/RSS_2/pulls/7","id":64299645,"html_url":"https://github.com/framgia/RSS_2/pull/7","diff_url":"https://github.com/framgia/RSS_2/pull/7.diff","patch_url":"https://github.com/framgia/RSS_2/pull/7.patch","issue_url":"https://api.github.com/repos/framgia/RSS_2/issues/7","number":7,"state":"open","locked":false,"title":"Edit MainActivity ( set Fragment, check connect internet, insertDataBase )","user":{"login":"huyquyet","id":14154998,"avatar_url":"https://avatars.githubusercontent.com/u/14154998?v=3","gravatar_id":"","url":"https://api.github.com/users/huyquyet","html_url":"https://github.com/huyquyet","followers_url":"https://api.github.com/users/huyquyet/followers","following_url":"https://api.github.com/users/huyquyet/following{/other_user}","gists_url":"https://api.github.com/users/huyquyet/gists{/gist_id}","starred_url":"https://api.github.com/users/huyquyet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huyquyet/subscriptions","organizations_url":"https://api.github.com/users/huyquyet/orgs","repos_url":"https://api.github.com/users/huyquyet/repos","events_url":"https://api.github.com/users/huyquyet/events{/privacy}","received_events_url":"https://api.github.com/users/huyquyet/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-28T08:09:32Z","updated_at":"2016-03-28T08:13:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75af62c8682d03a4d6f8086b258f6f275e278e57","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/RSS_2/pulls/7/commits","review_comments_url":"https://api.github.com/repos/framgia/RSS_2/pulls/7/comments","review_comment_url":"https://api.github.com/repos/framgia/RSS_2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/RSS_2/issues/7/comments","statuses_url":"https://api.github.com/repos/framgia/RSS_2/statuses/f934da18452837dc6086e02e17a95428d63cdcec","head":{"label":"huyquyet:init_project","ref":"init_project","sha":"f934da18452837dc6086e02e17a95428d63cdcec","user":{"login":"huyquyet","id":14154998,"avatar_url":"https://avatars.githubusercontent.com/u/14154998?v=3","gravatar_id":"","url":"https://api.github.com/users/huyquyet","html_url":"https://github.com/huyquyet","followers_url":"https://api.github.com/users/huyquyet/followers","following_url":"https://api.github.com/users/huyquyet/following{/other_user}","gists_url":"https://api.github.com/users/huyquyet/gists{/gist_id}","starred_url":"https://api.github.com/users/huyquyet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huyquyet/subscriptions","organizations_url":"https://api.github.com/users/huyquyet/orgs","repos_url":"https://api.github.com/users/huyquyet/repos","events_url":"https://api.github.com/users/huyquyet/events{/privacy}","received_events_url":"https://api.github.com/users/huyquyet/received_events","type":"User","site_admin":false},"repo":{"id":54180130,"name":"RSS_2","full_name":"huyquyet/RSS_2","owner":{"login":"huyquyet","id":14154998,"avatar_url":"https://avatars.githubusercontent.com/u/14154998?v=3","gravatar_id":"","url":"https://api.github.com/users/huyquyet","html_url":"https://github.com/huyquyet","followers_url":"https://api.github.com/users/huyquyet/followers","following_url":"https://api.github.com/users/huyquyet/following{/other_user}","gists_url":"https://api.github.com/users/huyquyet/gists{/gist_id}","starred_url":"https://api.github.com/users/huyquyet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huyquyet/subscriptions","organizations_url":"https://api.github.com/users/huyquyet/orgs","repos_url":"https://api.github.com/users/huyquyet/repos","events_url":"https://api.github.com/users/huyquyet/events{/privacy}","received_events_url":"https://api.github.com/users/huyquyet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/huyquyet/RSS_2","description":"RSS feed (training)","fork":true,"url":"https://api.github.com/repos/huyquyet/RSS_2","forks_url":"https://api.github.com/repos/huyquyet/RSS_2/forks","keys_url":"https://api.github.com/repos/huyquyet/RSS_2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huyquyet/RSS_2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huyquyet/RSS_2/teams","hooks_url":"https://api.github.com/repos/huyquyet/RSS_2/hooks","issue_events_url":"https://api.github.com/repos/huyquyet/RSS_2/issues/events{/number}","events_url":"https://api.github.com/repos/huyquyet/RSS_2/events","assignees_url":"https://api.github.com/repos/huyquyet/RSS_2/assignees{/user}","branches_url":"https://api.github.com/repos/huyquyet/RSS_2/branches{/branch}","tags_url":"https://api.github.com/repos/huyquyet/RSS_2/tags","blobs_url":"https://api.github.com/repos/huyquyet/RSS_2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huyquyet/RSS_2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huyquyet/RSS_2/git/refs{/sha}","trees_url":"https://api.github.com/repos/huyquyet/RSS_2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huyquyet/RSS_2/statuses/{sha}","languages_url":"https://api.github.com/repos/huyquyet/RSS_2/languages","stargazers_url":"https://api.github.com/repos/huyquyet/RSS_2/stargazers","contributors_url":"https://api.github.com/repos/huyquyet/RSS_2/contributors","subscribers_url":"https://api.github.com/repos/huyquyet/RSS_2/subscribers","subscription_url":"https://api.github.com/repos/huyquyet/RSS_2/subscription","commits_url":"https://api.github.com/repos/huyquyet/RSS_2/commits{/sha}","git_commits_url":"https://api.github.com/repos/huyquyet/RSS_2/git/commits{/sha}","comments_url":"https://api.github.com/repos/huyquyet/RSS_2/comments{/number}","issue_comment_url":"https://api.github.com/repos/huyquyet/RSS_2/issues/comments{/number}","contents_url":"https://api.github.com/repos/huyquyet/RSS_2/contents/{+path}","compare_url":"https://api.github.com/repos/huyquyet/RSS_2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huyquyet/RSS_2/merges","archive_url":"https://api.github.com/repos/huyquyet/RSS_2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huyquyet/RSS_2/downloads","issues_url":"https://api.github.com/repos/huyquyet/RSS_2/issues{/number}","pulls_url":"https://api.github.com/repos/huyquyet/RSS_2/pulls{/number}","milestones_url":"https://api.github.com/repos/huyquyet/RSS_2/milestones{/number}","notifications_url":"https://api.github.com/repos/huyquyet/RSS_2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huyquyet/RSS_2/labels{/name}","releases_url":"https://api.github.com/repos/huyquyet/RSS_2/releases{/id}","deployments_url":"https://api.github.com/repos/huyquyet/RSS_2/deployments","created_at":"2016-03-18T06:46:58Z","updated_at":"2016-03-25T02:08:47Z","pushed_at":"2016-03-28T08:08:43Z","git_url":"git://github.com/huyquyet/RSS_2.git","ssh_url":"git@github.com:huyquyet/RSS_2.git","clone_url":"https://github.com/huyquyet/RSS_2.git","svn_url":"https://github.com/huyquyet/RSS_2","homepage":null,"size":181,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"framgia:master","ref":"master","sha":"87e0aa94d611a9f1ce0afd4a1de61e64ff08bcb9","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":53999487,"name":"RSS_2","full_name":"framgia/RSS_2","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/RSS_2","description":"RSS feed (training)","fork":false,"url":"https://api.github.com/repos/framgia/RSS_2","forks_url":"https://api.github.com/repos/framgia/RSS_2/forks","keys_url":"https://api.github.com/repos/framgia/RSS_2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/RSS_2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/RSS_2/teams","hooks_url":"https://api.github.com/repos/framgia/RSS_2/hooks","issue_events_url":"https://api.github.com/repos/framgia/RSS_2/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/RSS_2/events","assignees_url":"https://api.github.com/repos/framgia/RSS_2/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/RSS_2/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/RSS_2/tags","blobs_url":"https://api.github.com/repos/framgia/RSS_2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/RSS_2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/RSS_2/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/RSS_2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/RSS_2/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/RSS_2/languages","stargazers_url":"https://api.github.com/repos/framgia/RSS_2/stargazers","contributors_url":"https://api.github.com/repos/framgia/RSS_2/contributors","subscribers_url":"https://api.github.com/repos/framgia/RSS_2/subscribers","subscription_url":"https://api.github.com/repos/framgia/RSS_2/subscription","commits_url":"https://api.github.com/repos/framgia/RSS_2/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/RSS_2/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/RSS_2/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/RSS_2/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/RSS_2/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/RSS_2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/RSS_2/merges","archive_url":"https://api.github.com/repos/framgia/RSS_2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/RSS_2/downloads","issues_url":"https://api.github.com/repos/framgia/RSS_2/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/RSS_2/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/RSS_2/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/RSS_2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/RSS_2/labels{/name}","releases_url":"https://api.github.com/repos/framgia/RSS_2/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/RSS_2/deployments","created_at":"2016-03-16T03:57:49Z","updated_at":"2016-03-23T03:52:46Z","pushed_at":"2016-03-28T08:09:32Z","git_url":"git://github.com/framgia/RSS_2.git","ssh_url":"git@github.com:framgia/RSS_2.git","clone_url":"https://github.com/framgia/RSS_2.git","svn_url":"https://github.com/framgia/RSS_2","homepage":null,"size":124,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/RSS_2/pulls/7"},"html":{"href":"https://github.com/framgia/RSS_2/pull/7"},"issue":{"href":"https://api.github.com/repos/framgia/RSS_2/issues/7"},"comments":{"href":"https://api.github.com/repos/framgia/RSS_2/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/RSS_2/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/RSS_2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/RSS_2/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/RSS_2/statuses/f934da18452837dc6086e02e17a95428d63cdcec"}}}}