Download Complete Source Code of Android Download and Play Video Stored In Sql Server

NOTE: You need to break your video if it is greater than 3mb.

How your App will look like on Android Device?

Download And Play Video

Ready these things for Download Video App

1) Android Studio Or Eclipse.

2) MSSQL Server.

3) Android Device.

4) Firewal must allow to connect to the database. (or turn off firewall from control pannel)

5) Download and add the 1.2.7 version of jtds jar file and include it in your project. If you don't know how to include a Jar file, See how to include jtds jar file to your project HERE.

Couple of things you need to keep in to your mind doing this tutorial.

1) The video should be inserted already in the database with the column type of nvarchar(Max) becuase the video is supposed to be stored in Base64 already

2) If you dont have inserted any video in the sql server before then you must need to insert a video in the database. Follow This tutorial to insert a video in to the database.

3) Must follow all steps and read them carefully.

4) This code is written with comments to make you understand easily. So please for learning purpose never copy and paste the code. Understand the code well so that you would be able to alter it according to your own needs.

5) Let us know the mistakes you think we have done in this project. These are warmly welcome becuase your suggestions would make us perfect.

6) You need to alter the database connection credentials used in this tutorial according to your server. you need to change the Ip:port/, username, password, database name in this tutorial with your server. The credentials used here are dummy.

Let's get Started...

After including the JTDS jar file. Your jtds Jar file should look like this
download video jtds add

After following all above steps, you need to open your App gradle module and add the following line into it

build.gradle (Module App)

Like this screenshot below:

download video app gradle

Now, Open your AndroidManifest.xml file and add the following Read, Write and Internet permissions after < /application> tag so that we will be able to access the gallery.


Now, Open your activity_main.xml file and paste the following code. This will be the layout of your video upload application. You can alter this layout according to your needs.


After adding the XML to your app, Your app design layout would look like this:

Download Video App

Last Step for the app completion, Open your file and replace the following code. Don't overwrite the package name of your app.

NOTE: Every line is commented to make you people understand well. Also, don't forget to change the database credentials according to your own needs.
All of application's java code lies here. Also, you need to mention the video type you are downloading in this code. Where you need to mention video format type is commented in the line somewhere below. Read it carefully

Screenshots of the App before and after downloading the Video

android download and play video app android download video android download video android download video

Download Complete Source Code of Download and Play Video Using Android