I made a listview with a videoview. When the application is running, the video starts automatically playing. I don't want that. The video should start playing when I click on it. I made an Adapter.
ArrayAdapter
MediaController mc; public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater LayoutInflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View listViewItem = LayoutInflater.inflate(R.layout.symptomlistitem, parent, false); TextView txtSymptom = (TextView)listViewItem.findViewById(R.id.txtSymptom); VideoView videoSymptom = (VideoView) listViewItem.findViewById(R.id.videoSymptom); Symptom symptom = this.getItem(position); txtSymptom.setText(symptom.getSymptom()); videoSymptom.setVideoURI(Uri.parse("android.resource://com.example.speechrecogniser/" + (symptom.getVideo()))); videoSymptom.setVisibility(View.VISIBLE); videoSymptom.setMediaController(mc); mc.setAnchorView(videoSymptom); videoSymptom.start(); return listViewItem; }
I've added the MediaController, but it didn't work. Can anyone help me please?