我想将finalResult数组返回给Java。任何帮助表示赞赏。
extern "C"
JNIEXPORT void JNICALL
Java_com_testjniproject_MainActivity_AnalyseImageDisplay(JNIEnv *env, jobject instance, jlong sourceImageArray)
{
Mat &srcInputImg = *(Mat*)sourceImageArray;
vector<tuple<string, string, int>> result = AnalyseImage(srcInputImg);
enter code here
string finalResult[3];
for (int i=0; i < result.size(); i++)
{
cout << get<0>(result[i]) << " : " << get<1>(result[i]) << " With confidence " << get<2>(result[i]) << "%" << endl;
finalResult[i] = get<1>(result[i]);
}
}
答案 0 :(得分:4)
您可以这样做:
b2.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if ( state )
{
state = false;
home.setVisibility(View.VISIBLE);
info.setVisibility(View.VISIBLE);
}
else
{
state = true;
home.setVisibility(View.GONE);
info.setVisibility(View.GONE);
}
}
}