java - SetDataAndType method -
as documented in android developers page setdataandtype method can called in way:
auto setdataandtypefunctionid = env->getmethodid(intentclassid, "setdataandtype", "(landroid/net/uri;ljava/lang/string;)v"); jstring jmime = env->newstringutf("video/*"); env->callvoidmethod(context, setdataandtypefunctionid, intentobject, uriobject, jmime);
but when run app error show on output:
java.lang.nosuchmethoderror: no method name='setdataandtype' signature='(landroid/net/uri;ljava/lang/string;)v' in class landroid/content/intent;
the problem return type, not void. setdataandtype method returns object of type intent
.
use following signature:
env->getmethodid(intentclassid, "setdataandtype", "(landroid/net/uri;ljava/lang/string;)landroid/content/intent;");
also, should use callobjectmethod instead of callvoidmethod, although doesn't matter because you're not using return value.
Comments
Post a Comment