public void loadMore() { if (getCommentsTask != null && getCommentsTask.getStatus() == AsyncTask.Status.RUNNING) getCommentsTask.cancel(true); getCommentsTask = new HttpAsyncGetTask(); this.current_page++; getCommentsTask.execute( "http://www.newzup.in/index.php/api/comments/" + this.post_id + "/offset/" + this.current_page); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.comments); preferences = PreferenceManager.getDefaultSharedPreferences(this); overridePendingTransition(R.anim.activity_open, R.anim.activity_close_scale); // Get post id of whose comments needs to be fetched. Intent i = getIntent(); this.post_id = i.getIntExtra("post_id", 1); this.title = i.getStringExtra("title"); setupActionBar(); TextView innerTitleTV = (TextView) findViewById(R.id.title); innerTitleTV.setText(this.title); etComment = (EditText) findViewById(R.id.commentText); // call AsynTask to perform network operation on separate thread getCommentsTask = new HttpAsyncGetTask(); getCommentsTask.execute("http://www.newzup.in/index.php/api/comments/"); // getCommentsTask.execute("http://www.newzup.in/index.php/api/comments/" + this.post_id + // "/offset/" + this.current_page); }