Example usage for android.os Bundle putSerializable

List of usage examples for android.os Bundle putSerializable

Introduction

In this page you can find the example usage for android.os Bundle putSerializable.

Prototype

@Override
public void putSerializable(@Nullable String key, @Nullable Serializable value) 

Source Link

Document

Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.cjc.activity.carManagement.CarDisassemblyTypeActivity.java

@Override
protected void addListeners() {
    tvMore.setOnClickListener(new View.OnClickListener() {
        @Override//from   w ww .j a v  a  2  s  . c o  m
        public void onClick(View v) {
            if (llMore.getVisibility() == View.VISIBLE) {
                tvMore.setText("");
                llMore.setVisibility(View.GONE);
            } else {
                tvMore.setText("");
                llMore.setVisibility(View.VISIBLE);
            }
        }
    });
    btnCarOut.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            loadCarOtData();

            //                AlertDialog.Builder builder = new AlertDialog.Builder(context);  //
            //                builder.setTitle("??"); //
            //                builder.setMessage("?"); //
            //                builder.setPositiveButton("", new DialogInterface.OnClickListener() { //
            //                    @Override
            //                    public void onClick(DialogInterface dialog, int which) {
            //                        dialog.dismiss(); //dialog
            //
            //                    }
            //                });
            //                builder.setNegativeButton("?", new DialogInterface.OnClickListener() { //?
            //                    @Override
            //                    public void onClick(DialogInterface dialog, int which) {
            //                        dialog.dismiss();
            //                    }
            //                });
            //                builder.show();
        }
    });
    gvImage.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (!StringUtils.isEmpty(carDisassemblyTypeAdapter.getItem(position).getOriginalUrl())) {
                Bundle bundle = new Bundle();
                bundle.putSerializable(Config.Extras.PictureList, (Serializable) dismantlePhotoBeanList);
                bundle.putInt(Config.Extras.Position, position);
                enterPage(PhotoViewActivity.class, bundle);
            }
        }
    });

}

From source file:com.davemorrissey.labs.subscaleview.sample.PageFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    View rootView = getView();//from  w w w . j ava  2s . c o  m
    if (rootView != null) {
        outState.putString(BUNDLE_ASSET, asset);
        SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) rootView.findViewById(id.imageView);
        ImageViewState state = imageView.getState();
        if (state != null) {
            outState.putSerializable(BUNDLE_STATE, imageView.getState());
        }
    }
}

From source file:edu.cloud.iot.reception.ocr.FaceRecognitionActivity.java

public void postFaceMatchRequest() {
    try {/*from  w ww  . ja v  a2  s.  c o m*/

        Log.i("EDebug:: postFaceMatchRequest():asyncFaceRecog.asyncState = ", asyncFaceRecog.asyncState + "");
        if (asyncFaceRecog.asyncState.equalsIgnoreCase("success")) {
            if (asyncFaceRecog.dSimilarity > 50) {
                Toast.makeText(getBaseContext(), "Identity verified Successfully!", Toast.LENGTH_LONG);
                Intent vrFormIntent = new Intent(this, VoiceRecognitionActivity.class);
                Bundle extra = new Bundle();
                extra.putSerializable("ocrresponse", ocrResponse);
                vrFormIntent.putExtra("list", extra);
                cameraView.camera.stopPreview();
                cameraView.camera.release();
                cameraView.camera = null;
                cameraView = null;
                startActivity(vrFormIntent);
            } else {
                Toast.makeText(getBaseContext(), "Identity Not verified!  Please try again.",
                        Toast.LENGTH_LONG);
            }
        } else {
            Toast.makeText(getBaseContext(), "Error Occured while verifying your identity!  Please try again.",
                    Toast.LENGTH_LONG);
        }

    } catch (Exception ex) {
        Log.i("EDebug:: postFaceMatchRequest():ERROR = ", ex.getLocalizedMessage() + "::" + ex.getMessage());
    }
}

From source file:com.best.ui.Otpdescdetail.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    System.out.println("in onOptionsItemSelected of stops.java");
    // Handle item selection
    switch (item.getItemId()) {
    /*case com.best.ui.R.id.mnusearch:
        System.out.println("in mnusearch of stops.java");
        if(tripsDisplayed == false)/*from   w  w w. ja  v a 2  s . c  o  m*/
        {
            Intent intent = new Intent(m_context, Search.class);
            intent.putExtra( "callFromStops" , true );
            me.startActivityForResult( intent, 5 );
            return true;
        }
        else
        {
            Intent intent = new Intent(m_context, Search.class);
            intent.putExtra( "callFromStops" , false );
            me.startActivityForResult( intent, 5 );
            return true;
        } */

    case com.best.ui.R.id.map:
        if (NearTripRoute._stopLat != null && NearTripRoute._stopLon != null) {
            System.out.println("in map of stops.java");
            Bundle bundle1 = new Bundle();
            bundle1.putBoolean("showSingle", false);
            bundle1.putSerializable("StopsGeoX", NearTripRoute._stopLat);
            bundle1.putSerializable("StopsGeoY", NearTripRoute._stopLon);
            Intent intent1 = new Intent(m_context, Map.class);
            intent1.putExtras(bundle1);
            me.startActivityForResult(intent1, 5);
        }
        return true;

    default:
        System.out.println("in default of stops.java");
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.eugene.fithealthmaingit.MainActivity.java

/**
 * Interface within FragmentJournalMainHome
 * Open suggestion FragmentSuggestionDialog
 *
 * @param mealType (snack, breakfast, lunch, dinner)
 * @param d        current date of the fragment
 *///  w  ww.ja v  a2  s  .  co m
@Override
public void viewSuggestion(String mealType, Date d) {
    FragmentManager fm = getSupportFragmentManager();
    FragmentSuggestionDialog suggestionFragment = new FragmentSuggestionDialog();
    Bundle bundle = new Bundle();
    bundle.putString(Globals.MEAL_TYPE, mealType);
    bundle.putSerializable(Globals.SUGGESTION_DATE, d);
    suggestionFragment.setArguments(bundle);
    suggestionFragment.show(fm, FragmentSuggestionDialog.TAG);
}

From source file:org.mifos.androidclient.templates.OperationFormActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putSerializable(PREVIOUS_STATE_BUNDLE_KEY, (Serializable) mPreviousResult);
}

From source file:com.fsa.en.dron.activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    RateThisApp.Config config = new RateThisApp.Config(5, 10);
    config.setTitle(R.string.my_own_title);
    config.setMessage(R.string.my_own_message);
    config.setYesButtonText(R.string.my_own_rate);
    config.setNoButtonText(R.string.my_own_thanks);
    config.setCancelButtonText(R.string.my_own_cancel);
    RateThisApp.init(config);/*from   w  w w. ja  v a 2 s. c o m*/
    RateThisApp.setCallback(new RateThisApp.Callback() {
        @Override
        public void onYesClicked() {
            final String appPackageName = getPackageName(); // getPackageName() from Context or Activity  object
            try {
                startActivity(
                        new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
            } catch (android.content.ActivityNotFoundException anfe) {
                startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
            }
        }

        @Override
        public void onNoClicked() {
            TastyToast.makeText(getApplicationContext(), "Vuelve pronto!", TastyToast.LENGTH_LONG,
                    TastyToast.INFO);
        }

        @Override
        public void onCancelClicked() {
            TastyToast.makeText(getApplicationContext(), "Prometo tomar mejores fotografias!",
                    TastyToast.LENGTH_LONG, TastyToast.ERROR);
        }
    });
    button = (Button) findViewById(R.id.button);
    button.setVisibility(View.INVISIBLE);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            checkConnection();
        }
    });
    BottomNavigationBar bottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);
    bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE);
    bottomNavigationBar.setMode(BottomNavigationBar.MODE_FIXED);
    bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC);
    bottomNavigationBar.setBarBackgroundColor(R.color.material_light_blue_800);
    bottomNavigationBar.setActiveColor(R.color.material_grey_900);
    bottomNavigationBar.setInActiveColor(R.color.material_blue_grey_200);
    bottomNavigationBar.addItem(new BottomNavigationItem(R.drawable.compose, "Mensaje"))
            .addItem(new BottomNavigationItem(R.drawable.sociales, "Sociales"))
            .addItem(new BottomNavigationItem(R.drawable.share, "Cuntale a un amigo")).initialise();
    bottomNavigationBar.setTabSelectedListener(new BottomNavigationBar.OnTabSelectedListener() {
        @Override
        public void onTabSelected(int position) {
            switch (position) {
            case 0:
                Intent email = new Intent(Intent.ACTION_SEND);
                email.putExtra(Intent.EXTRA_EMAIL, new String[] { "marceloespinoza00@gmail.com" });
                email.putExtra(Intent.EXTRA_SUBJECT, "Formosa en dron");
                email.putExtra(Intent.EXTRA_TEXT, "Dej tu mensaje");
                email.setType("message/rfc822");
                startActivity(Intent.createChooser(email, "Elige un cliente :"));
                break;
            case 1:
                Intent intent = new Intent(getApplication(), FacebookActivity.class);
                startActivity(intent);
                break;
            case 2:

                Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
                sharingIntent.setType("text/plain");
                sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Formosa en dron");
                sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                        "https://play.google.com/store/apps/details?id=com.fsa.en.dron");
                startActivity(Intent.createChooser(sharingIntent, "Compartir via"));
                break;

            }

        }

        @Override
        public void onTabUnselected(int position) {

        }

        @Override
        public void onTabReselected(int position) {
            switch (position) {
            case 0:

                break;
            case 1:
                Intent intent = new Intent(getApplication(), FacebookActivity.class);
                startActivity(intent);
                break;
            case 2:

                break;

            }
        }
    });
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    LayoutInflater inflator = LayoutInflater.from(this);
    View v = inflator.inflate(R.layout.toolbar_title, null);
    Typeface budget = Typeface.createFromAsset(getAssets(), "fonts/Budget.otf");
    Typeface typographica = Typeface.createFromAsset(getAssets(), "fonts/TypoGraphica.otf");
    TextView mToolbarCustomTitle = (TextView) v.findViewById(R.id.title);
    TextView mToolbarCustomSubTitle = (TextView) v.findViewById(R.id.subtitle);
    mToolbarCustomTitle.setText("Formosa");
    mToolbarCustomSubTitle.setText("en dron");
    mToolbarCustomTitle.setTypeface(typographica);
    mToolbarCustomSubTitle.setTypeface(budget);
    getSupportActionBar().setCustomView(v);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayShowCustomEnabled(true);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            int id = item.getItemId();
            if (id == R.id.recargar) {
                checkConnection();
            }
            if (id == R.id.info) {
                showDialog();
            }
            return false;
        }
    });
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    recyclerView.addOnItemTouchListener(new GalleryAdapter.RecyclerTouchListener(getApplicationContext(),
            recyclerView, new GalleryAdapter.ClickListener() {
                @Override
                public void onClick(View view, int position) {
                    Bundle bundle = new Bundle();
                    bundle.putSerializable("images", images);
                    bundle.putInt("position", position);

                    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                    SlideshowDialogFragment newFragment = SlideshowDialogFragment.newInstance();
                    newFragment.setArguments(bundle);
                    newFragment.show(ft, "slideshow");
                }

                @Override
                public void onLongClick(View view, int position) {

                }
            }));
    pDialog = new ProgressDialog(this);
    images = new ArrayList<>();
    mAdapter = new GalleryAdapter(getApplicationContext(), images);
    RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getApplicationContext(), 2);
    recyclerView.setLayoutManager(mLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(mAdapter);

}

From source file:com.brq.wallet.lt.activity.buy.AdSearchFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putSerializable(ADS, (Serializable) _ads);
}

From source file:com.github.barcodeeye.scan.CaptureActivity.java

private void handleDecodeInternally(Result rawResult, Bitmap barcode) {

    Uri imageUri = null;/*from  w  w w . j  a  v  a  2s  .c  o  m*/
    String imageName = IMAGE_PREFIX + System.currentTimeMillis() + ".png";
    Log.v(TAG, "Saving image as: " + imageName);
    try {
        imageUri = mImageManager.saveImage(imageName, barcode);
    } catch (IOException e) {
        Log.e(TAG, "Failed to save image!", e);
    }

    ResultProcessor<?> processor = ResultProcessorFactory.makeResultProcessor(this, rawResult, imageUri);

    if (!validateQRcode(rawResult.toString())) {
        Toast.makeText(getApplicationContext(), "Invalid QR code!", Toast.LENGTH_SHORT).show();
        onResume();
    } else {

        File f = new File(getCacheDir(), "LoginData.txt");

        FileOutputStream fos = null;
        try {
            if (!f.exists()) {
                f.createNewFile();
            }

            fos = new FileOutputStream(f, false);
            fos.write(rawResult.toString().getBytes());
            fos.close();

        } catch (IOException e) {
            Log.e(TAG, "Failed to save Login!", e);
        }

        // Intent Creation and Initialization
        Intent intent = new Intent(context2, InformationPreviewActivity.class);
        //I have added the line: (flags) (for closing the first activity)
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        // Create a Bundle and Put Bundle into it (SENDS PERSON)
        Bundle bundleObject = new Bundle();
        bundleObject.putSerializable("key", rawResult.toString());
        // Put Bundle into Intent and call start Activity
        intent.putExtras(bundleObject);
        startActivity(intent);
        //I have added the line: (finish) (for closing the first activity)
        finish();
    }
    //        startActivity(ResultsActivity.newIntent(this,processor.getCardResults()));
}

From source file:ch.scythe.hsr.TimeTableActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putSerializable(SAVED_INSTANCE_TIMETABLE_WEEK, week);
}