Saturday, March 8, 2014

 Questions about the handler, seeking answers about the great God who


Will:
Current Activity (used to fill in personal information in a single data) how to pass the message to the second Activity (used to process the data to be uploaded) to handle data to be uploaded.
Want to solve:
I click on the OK button is the first activity of the second activity will trigger a single data upload list
Previous wording:
From my previous adapter (with upload data list) is so written, this time replaced Activity should ask how to write?
private OnClickListener upload_OnClickListener = new OnClickListener () {

@ Override
public void onClick (View v) {
/ / TODO Auto-generated method stub
if (b_handler == false)
return;
/ / Message untreated
b_handler = false;

Integer x = (Integer) v.getTag ();
mHandler.obtainMessage (Upload.MESSAGE_ITEM_UPLOAD, (int) x, 0) sendToTarget ();.
}
};<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
In Activity1:
Intent intent = new Intent (this, Activity2.class);

intent.putExtra ("name", "user1");
intent.putExtra ("Age", 30);

startActivity (intent);

in Activity2:
String name = getIntent.getStringExtra ("name");
int Age = getIntent.getIntExtra ("Age", 0);
...
Reply:
I know the intent pass data, I said the message refers
mHandler.obtainMessage (Upload.MESSAGE_ITEM_UPLOAD, (int) x, 0) sendToTarget ();.
Send to upload the activity of.
Reply:
Your idea should be achieved with the handler trend is not, at present do not know the city, you can transfer data using intent or broadcast, downstairs waiting for answers
Reply:
In the main Cheng Zhongsheng a handler object, open a new thread in the Runnable's run in with a handler object to send a message with the data, the main thread handeler in handlermessage function to get the message. Roughly like this, is generally used to master and a new thread when the thread used for communication.
Reply:
Your request is usually carried out with intent data transfer.
Reply:
Why not use radio and Intent handler why we must do?
Reply:
I did not want to use, is the former Big Brother to write code that is used to upload data handler processing
Now there is a business that is, when I click on the current interface "OK button" trigger event upload second screen monitor, "Start automatically upload"
I want to know not only transfer data with intent it? It also controls the upload feature event listeners do?

No comments:

Post a Comment