Hi MV
Use totally the same with your “"<input type="file" id="coverUpload"
name="coverFiles[]" accept="image/*" />””, it works well in my testing.
The image that chose can be shown in the area of mImageView.
My sample as below, you can double check it.
public class OpenFileChooser extends XWalkActivity {
private XWalkView mXWalkView;
private ImageView mImageView;
private ValueCallback<Uri> mUploadMessage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.openfile_layout);
mXWalkView = (XWalkView) findViewById(R.id.xwalkview);
mImageView = (ImageView) findViewById(R.id.imageview);
}
@Override
protected void onXWalkReady() {
mXWalkView.setUIClient(new UIClient(mXWalkView));
mXWalkView.load("file:///android_asset/open_file.html", null);
}
class UIClient extends XWalkUIClient {
public UIClient(XWalkView xwalkView) {
super(xwalkView);
}
public void openFileChooser(XWalkView view, ValueCallback<Uri>
uploadFile, String acceptType, String capture) {
super.openFileChooser(view, uploadFile, acceptType, capture);
mUploadMessage = uploadFile;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent
intent) {
// TODO Auto-generated method stub
if (mUploadMessage == null || resultCode != RESULT_OK ) return;
Uri result = intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
Bitmap bm = null;
ContentResolver resolver = getContentResolver();
try {
bm = MediaStore.Images.Media.getBitmap(resolver, result);
mImageView.setImageBitmap(bm);
bm = null;
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Best Regards ☺
Xiaofeng Zhang
From: Crosswalk-help
[mailto:[email protected]] On Behalf Of
Mokshith Voodarla
Sent: Thursday, July 14, 2016 6:09 AM
To: [email protected]
Subject: [Crosswalk-help] Image Upload not working in Crosswalk
With an input tag like "<input type="file" id="coverUpload" name="coverFiles[]"
accept="image/*" />” crosswalk isn’t taking any input and is displaying no
actions. This kind of image input works on Chrome and some other browsers but
it isn’t working here?
Any tips on what to do?
Thanks,
MV
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help