# Need Help with play video

**URL:** https://discourse.processing.org/t/need-help-with-play-video/20260
**Category:** Processing for Android
**Created:** [April 29, 2020, 11:35am UTC](https://discourse.processing.org/t/need-help-with-play-video/20260 "2020-04-29T11:35:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![MonteliaRO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monteliaro/32/8303_2.png) [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)
#### Post date: [April 29, 2020, 11:35am UTC](https://discourse.processing.org/t/need-help-with-play-video/20260/1 "2020-04-29T11:35:58Z")

</div>

I need Help with the code from @noel

```auto
import android.view.View; 
import android.content.Context; 
import android.widget.Button; 
import android.app.Activity; 
import android.view.Gravity; 
import android.graphics.Color; 
import android.speech.RecognizerIntent; 
import android.content.Intent; 
import android.widget.Toast; 
import java.lang.Throwable; 
import java.lang.Exception; 
import java.lang.RuntimeException; 
import android.content.ActivityNotFoundException; 
import java.util.Locale; 
import android.view.ViewGroup.LayoutParams; 
import android.widget.FrameLayout; 
import android.view.View.OnClickListener; 
import android.content.Context; 
import android.speech.SpeechRecognizer; 
Activity act; 
Intent intent; 
Button bouton; 
private static final int MY_BUTTON1 = 9000; 
FrameLayout fl; 
Context context; 
String txt; 
void settings() { 
  fullScreen();
}; 
public void onStart() { 
  act = this.getActivity(); 
  context = act.getApplicationContext(); 
  bouton = new Button(act); 
  bouton.setText("Start Speaking"); 
  bouton.setBackgroundColor(Color.WHITE); 
  bouton.setId(MY_BUTTON1); 
  OnClickListener oclMonBouton = new OnClickListener() { 
    public void onClick(View v) { 
      println("Tab here"); 
      startSpeech();
    }
  }; 
  bouton.setOnClickListener(oclMonBouton); 
  fl = (FrameLayout)act.getWindow().getDecorView().getRootView(); 
  getActivity().runOnUiThread(new Runnable() {
    public void run() { 
      FrameLayout.LayoutParams params1 = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.TOP); 
      fl.addView(bouton, params1);
    }
  }
  );
} 
void setup() { 
  act = this.getActivity();
} 
void draw() { 
  fill(255); 
  background(0); 
  if (txt != null) { 
    text(txt, width/2, height/2);
  }
} 
private void startSpeech() { 
  Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); 
  try { 
    this.getActivity().startActivityForResult(intent, 666);
  } 
  catch (ActivityNotFoundException a) { 
    Toast.makeText(this.getActivity().getApplicationContext(), "This phone does not support this", Toast.LENGTH_SHORT).show();
  }
} 
void onActivityResult(int requestCode, int resultCode, Intent data) { 
  switch (requestCode) { 
  case 666: 
    { 
      if (resultCode == Activity.RESULT_OK && null != data) {//data are returned && the phone can use speechToText ArrayList<String> 
        result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); 
        background(255); 
        txt = (result.get(0)); 
        println(txt);
      } 
      break;
    }
  }
} 

```

 ![Screenshot_20200429-133346_APDE](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0fb10c15a9d90d038d6dfa033c8d8776e55d2980.jpeg)

Its a android code and i would Play a video

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [April 29, 2020, 12:54pm UTC](https://discourse.processing.org/t/need-help-with-play-video/20260/2 "2020-04-29T12:54:20Z")

</div>

> [@MonteliaRO](#):
>
> I need Help with the code from @noel

As is written on top of the example; this is coded by @akenaton It is not my code  
But you left out “ArrayList” before result. Checkit out.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [April 29, 2020, 2:42pm UTC](https://discourse.processing.org/t/need-help-with-play-video/20260/3 "2020-04-29T14:42:57Z")

</div>

@MonteliaRO ===  
See the error code; result is not a field:

```auto

ArrayList<String>result = new ArrayList<String>;

```

and i cannot see anything related to video in this code…
