Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

RadAsyncupload on WebView

$
0
0

Hello everyone.

I'm having a problem with an Android app. The app use a webview control to display and navigate a webpage. On the webpage I have a radasyncupload for uploading images. This woks perfectly both on the web page and the app FOR LOLLIPOP(Android 5.1.1).

My problem happens when I try to upload an image on Jellybean (Android 4.1.2), I'm able to upload the file to the control but when I hit the "Upload" button, that process the images I get the error "Parameter no valid" in the WEBPAGE code line "Bitmap upBmp = (Bitmap)Bitmap.FromStream(CurrentFile.InputStream);"

 

On the android app, when I hit the file upload bar it calls the following code:

public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
                //openFileChooser(uploadMsg, acceptType);
            mUploadMessage = uploadMsg;  
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);  
                i.addCategory(Intent.CATEGORY_OPENABLE);  
                i.setType("image/*");
                startActivityForResult( Intent.createChooser( i, "File Chooser" ), FILECHOOSER_RESULTCODE );
            }

And after I choose the file:

 public void onActivityResult (int requestCode, int resultCode, Intent data) {
 
        // code for all versions except of Lollipop
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
 
            if(requestCode==FILECHOOSER_RESULTCODE) {
                if (null == this.mUploadMessage) {
                    return;
                }
 
                Uri result=null;
 
                try{
                    if (resultCode != RESULT_OK) {
                        result = null;
                    } else {
                        // retrieve from the private variable if the intent is null
                        result = data == null ? mCapturedImageURI : data.getData();
                    }
                }
                catch(Exception e) {
                    Toast.makeText(getApplicationContext(), "activity :"+e, Toast.LENGTH_LONG).show();
                }
 
                mUploadMessage.onReceiveValue(result);
                mUploadMessage = null;
            }
 
        } // end of code for all versions except of Lollipop

...

 

It's a very strange problem and every help will be very appreciated.


Viewing all articles
Browse latest Browse all 94857

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>