1. layout file content:
<? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: orientation = "vertical"> <TextView android: id = "@ + id/target_number" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_marginLeft = "60sp" android: layout_marginTop = "20sp"> </TextView> <Spinner android: id = "@ + id/target_pinner" android: layout_width = "200sp" android: layout_height = "wrap_content" android: layout_marginLeft = "60sp" android: layout_marginTop = "20sp"> </Spinner> <TextView android: id = "@ + id/consult_number" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_marginLeft = "60sp" android: layout_marginTop = "20sp"> </TextView> <Spinner android: id = "@ + id/consult_spinner" android: layout_width = "200sp" android: layout_height = "wrap_content" android: layout_marginLeft = "60sp" android: layout_marginTop = "20sp"> </Spinner> <Button android: id = "@ + id/manage_operation" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "100sp" android: layout_marginTop = "20sp" android: text = "execution scheduling" android: textSize = "18sp"> </Button> </LinearLayout>
2. JAVA program code:
Import java. io. bufferedReader; import java. io. inputStreamReader; import java. util. arrayList; import java. util. list; import org. apache. http. httpResponse; import org. apache. http. httpStatus; import org. apache. http. nameValuePair; import org. apache. http. client. entity. urlEncodedFormEntity; import org. apache. http. client. methods. httpPost; import org. apache. http. impl. client. defaultHttpClient; import org. apache. http. m Essage. basicNameValuePair; import org. apache. http. protocol. HTTP; import org. json. JSONArray; import org. json. JSONObject; import com. sxzichen. common. MD5Util; import android. app. activity; import android. content. intent; import android. OS. bundle; import android. view. menu; import android. view. view; import android. view. view. onClickListener; import android. widget. adapterView; import android. widget. adapterView. onItemS ElectedListener; import android. widget. arrayAdapter; import android. widget. button; import android. widget. spinner; import android. widget. textView; public class SameQuen_Activity extends Activity implements OnClickListener {private static final String [] queuinfo = {"A01", "A02", "A03", "A04", "A05 ", "A06", "A07", "A08", "A09", "A10", "A11"}; private TextView target_view; private Spinner target_spinner; private Arra YAdapter <String> target_adapter; private TextView consult_view; private Spinner consult_spinner; private ArrayAdapter <String> consult_adapter; private String targetNumber = ""; private String consultMunber = ""; @ Override protected void onCreate (Bundle savedInstanceState) {// TODO Auto-generated method stub super. onCreate (savedInstanceState); setContentView (R. layout. activity_samequeu); // defines the target queuing number drop-down menu Target_view = (TextView) findViewById(R.id.tar get_number); target_spinner = (Spinner) specify get_pinner); // connect the optional content with ArrayAdapter target_adapter = new ArrayAdapter <String> (this, android. r. layout. simple_spinner_item, queuinfo); // set the style of the drop-down list target_adapter.setDropDownViewResource (android. r. layout. simple_spinner_dropdown_item); // Add the adapter to the spinner target_spinner.setAdapter (target_adap Ter); // Add the event Spinner event to listen to target_spinner.setOnItemSelectedListener (new BooldSpinnerSelectedListener (); // set the default value target_spinner.setVisibility (View. VISIBLE); // define the findViewById (R. id. consult_number); consult_spinner = (Spinner) findViewById (R. id. consult_spinner); // connect the optional content with ArrayAdapter consult_adapter = new ArrayAdapter <String> (this, android. r. layout. simple_spinner_ I Tem, queuinfo); // set the style consult_adapter.setDropDownViewResource (android. r. layout. simple_spinner_dropdown_item); // Add the adapter to the spinner consult_spinner.setAdapter (consult_adapter); // Add the event Spinner event listener (new MobleSpinnerSelectedListener (); // set the default value of listener (View. VISIBLE); Button manage_operation = (Button) findViewById (R. id. manage_operation); Manage_operation.setOnClickListener (this);} // select the target queuing number event listener class BooldSpinnerSelectedListener implements OnItemSelectedListener {public void onItemSelected (AdapterView <?> Arg0, View arg1, int arg2, long arg3) {targetNumber = queuinfo [arg2]; target_view.setText ("the queue number to be moved is:" + queuinfo [arg2]);} public void onNothingSelected (AdapterView <?> Arg0) {}}/// select reference queue number event listener class MobleSpinnerSelectedListener implements OnItemSelectedListener {public void onItemSelected (AdapterView <?> Arg0, View arg1, int arg2, long arg3) {consultMunber = queuinfo [arg2]; consult_view.setText ("move to" + queuinfo [arg2] + "");} public void onNothingSelected (AdapterView <?> Arg0) {}}@ Overridepublic void onClick (View v) {System. out. println ("scheduling in the same queue"); System. out. println ("execute" + targetNumber + "move to" + consultMunber + ""); // switch (v. getId () {// the corresponding prompt is displayed based on the buttons you click. /// case R. id. breke_queuing: // System. out. println ("entering the queue"); // startBreakQuening (user_name, estination_code); // break; // queue management // case R. id. same_queuing: // System. out. println ("entering the same queue management link"); // sameMangerQuening (user_name, estination_code); // break; // queue management // case R. id. diff1__queuing: // System. out. println ("entering different queue management links"); // diffusers mangerquening (user_name, estination_code); // break; // }}@ Overridepublic boolean onCreateOptionsMenu (Menu menu) {// Inflate the menu; this adds items to the action bar if it is present. getMenuInflater (). inflate (R. menu. activity_main, menu); return true ;}}