【发布时间】:2017-08-18 18:10:36
【问题描述】:
我在我的异步任务中调用 convertResponseToString 但是我也有一个按钮,我如何让 logo.feature 在新活动中显示输出? 基本上我想在新活动中显示消息。有什么建议吗?
> 'public String convertResponseToString(BatchAnnotateImagesResponse
> response) {
> String message = "I FOUND THESE THINGS = :\n\n";
>
> List<EntityAnnotation> logos = response.getResponses().get(0).getLogoAnnotations();
> List<EntityAnnotation> labels = response.getResponses().get(0).getLabelAnnotations();
> if (logos != null) {
> for (EntityAnnotation logo : logos) {
> String s = logo.getDescription();
> EditText logodesc=(EditText)findViewById(R.id.editText);
> logodesc.setText(s);
> message += String.format(Locale.US, "The score is : %.3f & The logo detected is : %s ",
> logo.getScore(),logo.getDescription());
> message += "\n\n";
> }
> } else {
> message += "NOTHING FOUND!\n";
> }
> if(labels !=null) {
> for (EntityAnnotation label : labels) {
> message += String.format(Locale.US, "The score is: %.3f & The label detected is : %s ", label.getScore(),
> label.getDescription());
> message += "\n";
> }
> }else{
> message += "NOTHING FOUND!";
> }
> return message;
>
> }
> public void init()
> {
> mbutton=(Button)findViewById(R.id.button);
> mbutton.setOnClickListener(new View.OnClickListener() {
> @Override
> public void onClick(View view) {
> Intent i = new Intent(MainActivity.this,Result.class);
> i.putExtra("Logo");
> startActivity(i);
> }
> });
> }
}'
【问题讨论】:
标签: android android-intent android-asynctask google-cloud-platform