How about the Android WebView?
Override openFileChooser only ensure there is a file chooser, if you want to do
something else, such as show the picture, you should also override
onActivityResult, that the same as Android WebView,
https://developer.android.com/training/basics/intents/result.html,
here is an example, just for you reference.
@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: Wilmar Martinez [mailto:[email protected]]
Sent: Wednesday, October 12, 2016 3:59 AM
To: Zhang, Xiaofeng <[email protected]>;
[email protected]
Subject: Re: Problem with file input in my website
Good afternoon,
The problem is the following, I have a website but not work the file input, I
had used all the library core in android studio
(https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/),
but not work,
When I give click and show dialog, but I select a picture and not work, and
then I give click again and not show dialog,
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
XWalkView xWalkWebView=(XWalkView)findViewById(R.id.xwalkWebView);
xWalkWebView.clearCache(true);
xWalkWebView.load("https://postimage.org", null);
// turn on debugging
XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
}
}
And this not work
public class MainActivity extends AppCompatActivity {
private XWalkView mXWalkView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
XWalkView xWalkWebView = (XWalkView) findViewById(R.id.xwalkWebView);
xWalkWebView.load("https://postimage.org", null);
mXWalkView.setUIClient(new XWalkUIClient(mXWalkView) {
@Override
public void openFileChooser(XWalkView view, final ValueCallback
uploadFile, String
acceptType, String capture) {
uploadFile.onReceiveValue(null);
}
});
}
}
Attentively,
Wilmar Martinez
________________________________
De: Zhang, Xiaofeng <[email protected]<mailto:[email protected]>>
Enviado: lunes, 10 de octubre de 2016 8:23:54 p. m.
Para: Wilmar Martinez;
[email protected]<mailto:[email protected]>
Asunto: RE: Problem with file input in my website
Hi
Which version you are using? I am not sure where you download the "last
embedded core".
Before Crosswalk 22, there is a default file chooser, so you don't need
override openFileChooser.
Since Crosswalk 23, please see the usage sample here
https://crosswalk-project.org/jira/browse/XWALK-7271
One question, why you load nothing? "xWalkWebView.load("", null);"
Best Regards :)
Xiaofeng Zhang
From: Crosswalk-help
[mailto:[email protected]] On Behalf Of Wilmar
Martinez
Sent: Tuesday, October 11, 2016 5:36 AM
To:
[email protected]<mailto:[email protected]>
Subject: [Crosswalk-help] Problem with file input in my website
good afternoon,
I have a problem with the file input in my website, not show dialog, I had read
several text but not have the solution, I am using the last embedded core.
public class MainActivity extends AppCompatActivity {
private XWalkView mXWalkView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
XWalkView xWalkWebView = (XWalkView) findViewById(R.id.xwalkWebView);
xWalkWebView.load("", null);
mXWalkView.setUIClient(new XWalkUIClient(mXWalkView) {
@Override
public void openFileChooser(XWalkView view, final ValueCallback
uploadFile, String
acceptType, String capture) {
uploadFile.onReceiveValue(null);
}
});
}
}
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help