Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $return = array();
- switch($_REQUEST['action']){
- case 'register':
- $v = true;
- $fields = array('u_first_name', 'u_last_name');
- foreach($fields as $f)
- ${$f} = $_REQUEST[$f];
- $image_file = $_FILES['profile_image'];
- //validate, upload image and manipulate db
- }
- submit_button.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- Boolean f;
- Boolean i;
- //Get All Fields
- Edi_First_Name = (EditText)findViewById(R.id.Edi_First_Name);
- Edi_Last_Name = (EditText)findViewById(R.id.Edi_Last_Name);
- image_preview = (ImageView)findViewById(R.id.Reg_Profile_Image_Preview);
- //check if any fields are empty, if not proceed to api, else show errors
- f = Function.notEmpty("First Name", Edi_First_Name);
- f &= Function.notEmpty("Last Name", Edi_Last_Name);
- //check if image has been set
- i = Function.imageNotSet(image_preview);
- f &= i;
- if(f == true){
- //if everything is validated,talk to api.
- String first_name, last_name, company_name, job_title, email, contact, address_one, address_two, town, county, postcode, country, account_email, rep_account_email, account_password, rep_account_password;
- first_name = Function.getEditText(Edi_First_Name);
- last_name = Function.getEditText(Edi_Last_Name);
- //pass parameters so that we can call the register api via FUNCTIONS.java
- Function.registerCall(first_name, last_name, "test_image");
- }
- else{
- Toast.makeText(getApplicationContext(), "Error.", Toast.LENGTH_SHORT).show();
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement