Mobile Development - Survey

  • Design ideas
  1. First survey requires two pages, is a user interface issue option to select the questionnaire, the results of a user survey feedback page.
  2. Questionnaire interface has a problem, radio, multiple choice, as well as text edit box, and two buttons, one to submit a return. For many questions, so I took a pull-down scrolling layout, user-friendly operation.
  3. Feedback interface is very simple and requires a lot of layout and controls, as long as the return value can be read on the line, I use the Bundle class and class Intent
  4. Direct interface to achieve response to button clicks by Activity. Rewrite onCreate () and onCheckedChanged () and onCheckedChanged () and onClick () event of listening
  5. Activity results achieved by transmitting the feedback to the interface. Data transmissions by Bundle, Intent jump page.
  • Layout Control
  1. ScrollView layout using the drop-down scrolling function to achieve
  2. Linear layout and relative layout make the layout clearer neat
  3. <TextView> write the title and content requirements
  4. <RadioGroup> and <RadioButton> function implemented radio
  5. <CheckBox> multi-select function
  6. <EditText> implement text editing functions.
  • Debugging process

            

  1. In the beginning of the test, click the submit button, the page jump did not happen, but later found that I forgot to configure the second page in the AndroidManifest.xml file, modified, successful jump page. code show as below:
<activity android:name=".MainActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity android:name=".ResultActivity">
    <intent-filter>
        <action android:name="android.intent.action.Result" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

 code show as below:

 

  1.  During the test found a problem with listening radio button events, duplicate clicks, then there will be multiple results, such as the twice A three point B, then the result is A feedback display. *** A. *** A. ** * B. *** B. *** B. ***, resulting in duplication of results, and for the first time elected, and the result was later canceled reservations. This is because I use to store multiple choice list of results, when the listener is not re-check the list and remove unselected. I was checkboxes monitor code changes. Create two variables, the number of clicks a store button, the button is selected or the result of a store. If the number is an even number, and the options that exist in the list, remove from the list. If not in the list and the number is odd, put options added to the list.
switch (checkboxId){
    case R.id.cb_side1:
        cs11++;
        for(int i=0;i<sides.size();i++)
        {
            if(sides.get(i)==cb_side1.getText().toString()) {
                cs1++;
            }
            if(cs11%2==0&&sides.get(i)==cb_side1.getText().toString())
            {
                sides.remove(i);
                cs1=0;
            }
        }
        if(cs1==0&&cs11%2!=0) {
            cs1++;
            sides.add(cb_side1.getText().toString());
        }
        break;

 

  • operation result

 

Figure 1-4 b Run Test Results FIG.

图1-5 运行测试结果图c

图1-6运行结果反馈图

图1-7必填选项未选结果图

Guess you like

Origin blog.csdn.net/floraruo/article/details/88778350