public void showServiceInAction() { Intent i = new Intent(this, ServiceInActionActivity.class); i.putExtra(CONSTANTS.ID_CLIENT, id_cliente); i.putExtra(CONSTANTS.ID_SERVICE, service_id); i.putExtra(CONSTANTS.ID_SHERPA, sherpa_id); // i.putExtra(CONSTANTS.DESTINATIONS_NAME, destinations); String data = ""; try { data = ObjectSerializer.serialize(destinations); } catch (IOException e) { e.printStackTrace(); } // i.putExtra(CONSTANTS.DESTINATIONS_NAME, destinations); SharedPreferences settings = this.getSharedPreferences("com.fr3estudio.sherpaV3P.UsersData", Context.MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); editor.putString(CONSTANTS.DESTINATIONS_NAME, data); editor.commit(); startActivity(i); this.finish(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_waiting_for_sherpa); ActionBar mActionBar = getSupportActionBar(); mActionBar.setDisplayShowHomeEnabled(false); mActionBar.setDisplayShowTitleEnabled(false); LayoutInflater mInflater = LayoutInflater.from(this); View mCustumView = mInflater.inflate(R.layout.menu_action_bar, null); ((Button) mCustumView.findViewById(R.id.show_menu_ma)) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { System.out.println("mostrar el creado desde el main."); is_overlay_shown++; overlayIntent = new Intent(v.getContext(), OverlayActivity.class); overlayIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); overlayIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); overlayIntent.putExtra("code", OverlayActivity.SHOW_MENU); startActivityForResult(overlayIntent, CONSTANTS.MENU_OPTION); overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left); } }); mActionBar.setCustomView(mCustumView); mActionBar.setDisplayShowCustomEnabled(true); h = new Handler(); r = new Runnable() { @Override public void run() { isServiceAttended(); } }; ImageView loading = (ImageView) findViewById(R.id.imageView1); loading.setBackgroundResource(R.drawable.loading_animation); loadingAnimation = (AnimationDrawable) loading.getBackground(); loadingAnimation.start(); // destinations = this.getIntent().getParcelableExtra(CONSTANTS.DESTINATIONS_NAME); SharedPreferences settings = this.getSharedPreferences("com.fr3estudio.sherpaV3P.UsersData", Context.MODE_PRIVATE); String data = settings.getString(CONSTANTS.DESTINATIONS_NAME, ""); try { destinations = (ArrayList<Destination>) ObjectSerializer.deserialize(data); } catch (IOException e) { e.printStackTrace(); showDialog( getResources().getString(R.string.msg_savingData_title), getResources().getString(R.string.msg_detail_internal), false, false); destinations = new ArrayList<>(); } Log.i("Waiting", "se cargaron: " + destinations.size() + " destinos"); insert_service = this.getIntent().getBooleanExtra(CONSTANTS.INSERT_SERVICE, false); id_cliente = this.getIntent().getIntExtra(CONSTANTS.ID_CLIENT, 0); if (insert_service) { insertServiceRequest(); } else { service_id = this.getIntent().getIntExtra(CONSTANTS.ID_SERVICE, 0); scheduleAttentionQuery(0); } }