@Override public boolean onPostExecute(RequestInfo req) { switch (req.getStatusCode()) { case HttpStatus.SC_OK: Item item = new Item(PostActivity.this); HashMap<Integer, String> map = new HashMap<Integer, String>(); for (Gc value : items) { if (value.gcid == 0) { continue; } map.put(value.gcid, value.name); } item.setGcList(map); ArrayAdapter<String> adapter = new ArrayAdapter<String>( context, android.R.layout.simple_spinner_item, item.getGcValues()); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spin.setAdapter(adapter); break; default: Utility.log(PostActivity.this, "error:" + req.getStatusCode()); break; } return true; }
@Override public boolean onPostExecute(RequestInfo req) { if (task != null && task.isCancelled()) { return true; } switch (req.getStatusCode()) { case HttpStatus.SC_OK: switch (result) { case 1: Toast.makeText( PostActivity.this, getResources().getString(R.string.msg_post_success), Toast.LENGTH_SHORT) .show(); Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); PostActivity.this.finish(); break; case 101: // apidとkeyの組み合わせが不正 case 110: // uidが不足 case 111: // upが不足 case 112: // sidが不足 case 113: // gcidが不足 case 114: // valueが不足 case 115: // chkdateが不足 case 116: // inoutが不足 case 117: // floorが不足 case 118: // heightが不足 Toast.makeText( PostActivity.this, String.format(getResources().getString(R.string.msg_post_failed), result), Toast.LENGTH_SHORT) .show(); break; case 130: // 該当ユーザがいない Toast.makeText( PostActivity.this, getResources().getString(R.string.msg_post_failed_not_found_user), Toast.LENGTH_SHORT) .show(); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(PostActivity.this); Editor editor = pref.edit(); editor.remove("settings_uid"); editor.remove("settings_user_id"); editor.remove("settings_passwd_md5"); editor.commit(); break; case 131: // 該当する有効なスポットがない Toast.makeText( PostActivity.this, getResources().getString(R.string.msg_post_failed_not_found_spot), Toast.LENGTH_SHORT) .show(); break; default: Toast.makeText( PostActivity.this, String.format(getResources().getString(R.string.msg_post_failed), result), Toast.LENGTH_SHORT) .show(); break; } break; case RequestInfo.STATUS_NETWORK_CONNECT_ERROR: Toast.makeText( PostActivity.this, getResources().getString(R.string.error_msg_network_connection), Toast.LENGTH_SHORT) .show(); break; default: Toast.makeText( PostActivity.this, getResources().getString(R.string.error_msg_server), Toast.LENGTH_SHORT) .show(); break; } return false; }