openxc / openxc-android

Android library for accessing vehicle data from an OpenXC vehicle interface
BSD 3-Clause "New" or "Revised" License
236 stars 115 forks source link

How to setResult large size in Android #273

Closed VichitGit closed 6 years ago

VichitGit commented 6 years ago

I want to get result back from SecondActivity to display in FirstActivity. below is my code. FirstActivity startActivityForResult(new Intent(getApplicationContext(), SecondActivity.class), 10);

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
       mSummerNote = data.getStringExtra("textSummerNote");
            if (!mSummerNote.isEmpty() && !mSummerNote.equals("<p><br></p>") && !mSummerNote.equals("<p></p>")) {
                //Log.e("pppp", mSummerNote);
                linearContent.setVisibility(View.GONE);
                relativeLayoutContent.setVisibility(View.VISIBLE);

                webView.loadDataWithBaseURL(null,
                        "<style type='text/css'>img{display: inline; height: auto; max-width: 100%; width:auto;} " +
                                "iFrame{width:100%; height:250px;}" +
                                "@font-face { font-family: \"Battambang\"; src: url('file:///android_asset/fonts/KhmerOSContent-Regular.ttf');}" +
                                "p{text-align:left|right|center; line-height: 180%; font-family: 'Battambang'; font-size: 13px;}" +
                                "</style> " + mSummerNote,
                        "text/html", "UTF-8", null);
                webView.getSettings().setJavaScriptEnabled(true);
            } else {
                //Log.e("pppp", mSummerNote);
                linearContent.setVisibility(View.VISIBLE);
                relativeLayoutContent.setVisibility(View.GONE);
            }

        }
    }

SecondActivity

buttonDone.setOnClickListener(view -> {

            Intent intent = new Intent();
            intent.putExtra("textSummerNote", summernote.getText());
            setResult(10, intent);
            finish();
        });

When i click button done is show me some error: JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 1116252)

alokonly commented 6 years ago

Hi @VichitGit Is this something you are facing with OpenXC? If yes, can you elaborate a little more on specifically what are you trying to do? Generally, we face this error when trying to store large values in Parcel object.