Some tools that I used in Android Developing or life
read a json, and parse it to java classes : **Request, **Parser, **Response
- paster the json strings to the "test2.json" file
- run the command
groovy json_2_req_resp.groovy
Ok, now we have the java classes
this json2Request tool has a strong connnection with the network framework in your app.
different projects may have to adjust some code to generate the right Request/Response java class.
#1.3 Result
the script will auto generate three java classes: **Request, **Parser, **Response.
(If your project are not same as mine, you can custom the script for your own project.)
- the id of view should be "view_page_function". And the name of class member would be like "viewFunction".
For example:
<TextView android:id="@+id/tv_pay_bank_name" ... />
would be named :
private TextView tvBankName;
- if the id of view ends with
"_x"
, it means it will not be listed as a member in Class - if the id of view ends with
"_c"
, it means it will be listed as a member in Class, and it will be add the OnClickListener "android:id"
should be the first attribute of a View in the layout xml file
- paste your layout xml content to "layout.xml"
- run the "auto_findview.bat", or "auto_findview.bat"
private Button btnSendSms;
private TextView tvBankError;
private EditText etInputPwd;
etInputPwd = (EditText) findViewById(R.id.et_pay_input_pwd);
tvBankError = (TextView) findViewById(R.id.tv_pay_bank_error);
btnSendSms = (Button) findViewById(R.id.btn_pay_send_sms_c);
btnSendSms.setOnClickListener(this);
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_pay_send_sms_c:
break;
default:
break;
}
}
All you have to do is copy these lines to you own Activity file