android how to refresh the current page.
How to refresh the page after the completion of the current review, is displayed.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Invalidate
But you sure you want to refresh the page it?
If it is just like listview refresh them just fine
Reply:
What do you want to be?
Reply:
/ / Send button
case R.id.news_reply_post:
/ / Hide the input method
m.toggleSoftInput (0, InputMethodManager.HIDE_NOT_ALWAYS);
String str = mNewsReplyEditText.getText () toString ();.
if (str.equals ("")) {
Toast.makeText (CommentsActivity.this, "can not be empty",
. Toast.LENGTH_SHORT) show ();
}
else {
mNewsReplyEditLayout.post (new PostCommentsThread (mNid, "Guangzhou",
str + "",
new NewsDetailActivity ()));
mNewsReplyEditLayout.setVisibility (View.GONE);
mNewsReplyImgLayout.setVisibility (View.VISIBLE);
loader_ref ();
}
break;
}
public void loader_ref ()
{
new Thread ()
{
public void run ()
{
commentsAdapter.notifyDataSetChanged (); / / this refresh does not work
/ / Loaddata ();
}
.} Start ();
}
================================
Is
listview'sInvalidate is how to use it?
Reply:
Your new comment added commentsAdapter inside the Well?
Reply:
/ / Get the number of
NewsIntent intent = getIntent ();
mNid = intent.getIntExtra ("nid", 0);
mCommentsData = new ArrayList
Button commentsToNewBtn = (Button) findViewById (R.id.comments_titlebar_news);
getComments (mNid);
commentsAdapter = new SimpleAdapter (this, mCommentsData
, R.layout.comments_list_item_layout
, New String [] {"commentator_from", "comment_ptime", "comment_content"}
, New int [] {R.id.commentator_from, R.id.comment_ptime, R.id.comment_content});
commentsList = (ListView) findViewById (R.id.comment_list);
commentsList.setAdapter (commentsAdapter);
Reply:
/ / Instantiate a handler
Handler handler = new Handler ()
{
/ / After receiving the message processing
public void handleMessage (Message msg)
{
switch (msg.what)
{
case 1:
/ / Log.i ("--------------", "0000000000000000");
Intent intent = new Intent (CommentsActivity.this, CommentsActivity.class);
intent.putExtra ("nid", mNid);
startActivity (intent);
/ / CommentsAdapter.notifyDataSetChanged ();
/ / CommentsList.invalidate (); / / refresh interface
break;
}
super.handleMessage (msg);
}
};
If it can jump again. I do not know there is no better way to do
Reply:
The written description of the method call Adapter for notifyDataSetChanged () method is generally the main UI thread will work in it, empathy invalidate () method is the same, still need to borrow Handler in the main UI thread work . For insurance purposes, I usually practice together with the project is a combination of absolute and effective :)
commentsList.setAdapter (commentsAdapter) ;/ / Reset commentsAdapter
updated to listviewcommentsAdapter.notifyDataSetChanged (); / / update the display
Reply:
There are two way of life, one is required to take, one is the way you want to go. Must only take a good way to go, want to go to go to go its own way.
Reply:
Nima, grassland, and made a mistake
No comments:
Post a Comment