Contents

조회 수 4825 댓글 2
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

소스(java) 코드

import android.app.Activity; 
import android.net.Uri; 
import android.os.Bundle; 
import android.widget.MediaController; 
import android.widget.VideoView;

public class main extends Activity
{
  private static final String MOVIE_URL = "https://hooni.net/s_512kb.mp4";

  @Override
  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video);
    
    VideoView videoView = (VideoView) findViewById(R.id.VideoView);
    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    // Set video link (mp4 format )
    Uri video = Uri.parse(MOVIE_URL);
    videoView.setMediaController(mediaController);
    videoView.setVideoURI(video);
    videoView.requestFocus();
    videoView.start();
  }
}


레이아웃(xml) 코드

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout android:id="@+id/LinearLayout01"
  android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:paddingLeft="2px" android:paddingRight="2px"
  android:paddingTop="2px" android:paddingBottom="2px"
  android:layout_width="fill_parent"
  android:orientation="vertical">

    <VideoView android:layout_height="fill_parent"
      android:layout_width="fill_parent"
      android:id="@+id/VideoView">
  </VideoView>

</LinearLayout>

[출처] http://hekamedia.egloos.com/3551068


?

  1. [Android Error] The number of method references in a .dex file cannot exceed 64K

  2. [Android] 2010년에 만들었던 세미나 자료.

  3. [android] AlertDialog 메시지 창 띄우기

  4. [android] Android N requires the IDE to be running with Java 1.8 or later 오류

  5. [android] ArrayAdapter 테스트 파일 ㅎㅎ

  6. [android] ArrayAdapter를 이용하여 출력하기

  7. [android] Calling activity function from separate class

  8. [android] Canvas를 이용해 이미지 확대/축소 하기

  9. [android] dp, px 서로 변환

  10. [android] GCM 사용하기 1 (GCM 서비스 신청하기)

  11. [android] How can I place app icon on launcher home screen?

  12. [android] keytool을 사용하여 키스토어 생성

Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 98 Next
/ 98