I am working on my hobby project to learn more about android programming and stuffs. So i recently ran into a simple problem but couldn't find a solution for it.
My project for now have 2 activity [MainActivity], [CommentActivity].
In MainActivity, I have a listadapter will fetch all the content from a database and display it on a listview. Everything works fine there. It will fetch all the comments and total comments for a certain post based on the post id. In the same MainActivity, i have a comment button and a onclick listener which when clicked will bring user to the next activity [CommentActivity] and load all the comments and data needed using another custom adapter. I also have a total comment TextView that will show the total comment fetched by the json and display it in my listview.
When a user posted a comment on CommentActivity, it will save into the database via AsyncTask.
Now the problem is, when i press back button and navigate back from CommentActivity to MainActivity, i use intent with flag (intent.flag_activity_reorder_to_front). So it will never reload the MainActivity again when back button is pressed. Also it will never update the total comment in the MainActivity. What i want to do is when back button is pressed on CommentActivity, i want it to refresh/reload the ListAdapter in MainActivity to fetch the latest data from database.
I believe there must be some easy way to do this. I can post codes if you guys need it to assists me.
Page 1 of 1
0 Replies - 97 Views - Last Post: 20 July 2014 - 01:42 PM
Page 1 of 1