We use bitmap class for imageview_and I want know what the class for videoview instead bitmap?
3
- Try to make better your question, show what you tried to do in code.. if not i think this question would be closednachokk– nachokk2017-04-08 20:06:18 +00:00Commented Apr 8, 2017 at 20:06
- I want created on activity instead of many activity for my Listview'itemD.ask– D.ask2017-04-08 20:08:03 +00:00Commented Apr 8, 2017 at 20:08
- In other hand we use a bitmap class for imageview_what the class for video view instead of bitmapD.ask– D.ask2017-04-08 20:11:14 +00:00Commented Apr 8, 2017 at 20:11
Add a comment |
1 Answer
**Example of VideoView **
MainActivity.java
private VideoView videoView; private Button videoPlay; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); videoView = (VideoView)findViewById(R.id.VideoView); videoPlay=(Button)findViewById(R.id.button); videoPlay.setOnClickListener(this); } @Override public void onClick(View v) { if(v==videoPlay){ videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); videoView.start(); } } main.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.videotest.MainActivity"> <VideoView android:id="@+id/videoview" android:layout_width="300dp" android:layout_height="200dp"/> <Button android:text="Play" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/videoview" android:onClick="onButtonClick" android:id="@+id/button"/> </RelativeLayout> 