refresh Activity problems
hi i have a grid View of images in first Activity,and list view of images in 开发者_StackOverflowSecond Activity if user selects any one of image in list view using check box,i want to update Grid view in First Activity from Second(list View) with out going to grid view(current View is list view). i tried by calling firstActivity.onStart(); Sets Again Grid View its going to crash...
I'm guessing...but your first gridview certainly gets its data from some adapter, so you may invoke the
gridViewAdapter.notifyDataSetChanged();
to explicitly tell the gridview it should refresh.
Calling someActivity.onStart() from your code is a bad idea as those methods are supposed to be invoked by the system itself rather than by programmer code.
Now, I don't exactly know how your activities are related to each other, but from what you provided in your question, I assume that your second activity is somehow a popup or whatever which lets the user select some images and the first activity is assumed to display the result, right?
In such case I would call the second activity by using startActivityForResult and once that activity returns do the refreshing stuff.
精彩评论