Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6048917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:31:02+00:00 2026-05-23T07:31:02+00:00

I have create a method for playing a video in a video player and

  • 0

I have create a method for playing a video in a video player and called that method on a button click, but whenever I was click on the button then the activity page blink for a half second but the player wasn’t appear on the screen. Plz help me Is there neccessary to create view or a layout for a video player for playing a video in xml file. I havn’t create this.

import android.app.Activity;

import android.content.Intent;
import android.graphics.PixelFormat;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.MediaController; 
import android.widget.VideoView;
public class OptionsmenuAct extends Activity  {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    final Button play =(Button)findViewById(R.id.video);
    Equity.setOnClickListener(new OnClickListener(){
        public void onClick(View V){
            videoPlayer("/Optionsmenu/assets/lic.3gp","lic",true);

        }
    });}





public void videoPlayer(String path, String fileName,boolean autoplay){

        getWindow().setFormat(PixelFormat.TRANSLUCENT);

        VideoView videoHolder = new VideoView(this);

        videoHolder.setMediaController(new MediaController(this));

        videoHolder.setVideoURI(Uri.parse(path+"/"+fileName));

        videoHolder.requestFocus();
        videoHolder.start();
        if(autoplay){
           videoHolder.start();
        }

     }
}

Plz tell me how’s it will worked.
I have store my video file into assets folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:31:02+00:00Added an answer on May 23, 2026 at 7:31 am

    You can use VideoView. See example of usage here.

    Adding VideoView to layout XML file is as any other component, for example (taken from android site):

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >
    
        <VideoView 
            android:id="@+id/surface_view" 
            android:layout_width="320px"
            android:layout_height="240px"
        />
    
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method that's about ten lines of code. I want to create
I would like to create a safe sum extension method that would have the
Hi I want to create a WCF service that have login method, which is
Hey guys. I have a method that gets called each second which I want
I have followed the steps to create my media player object but I cant
I have a winforms, and it connecting wit webservice. Webservice has method which create
I have a web service method in which I create a particular type of
I have this code working in C#: var request = (HttpWebRequest)WebRequest.Create(https://x.com/service); request.Method = GET;
I have created a new method in one of the project's controllers that it
I have created a console application that calls a method on a webservice. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.