Android Handler不同界面发送数据

发送端界面:

Bundle bundle = new Bundle();
			bundle.putString("introduce", "啊啊啊啊啊");
			Message message = CompletePartnerInformationFragment.completePartnerInfHandler.obtainMessage();
			message.what = Constants.MessageWhat.WHAT_REFRESH_PARTNER_INTRODUCE;
			message.setData(bundle);
			message.sendToTarget();

接收界面:

private void initHandler(){
		completePartnerInfHandler = new Handler(){

			@Override
			public void handleMessage(Message msg) {
				super.handleMessage(msg);
				switch (msg.what) {
				case Constants.MessageWhat.WHAT_REFRESH_PARTNER_INTRODUCE:
					Bundle bundle = msg.getData();
					String introduce = bundle.getString("introduce");
					introduceView.setText(introduce);
					break;

				default:
					break;
				}
			}
			
		};


你可能感兴趣的:(android,handler)