Tag Archives: Assets

Play Video in Flutter

By | May 30, 2019

This is a simple example to play a video in Flutter. Add Plugin We will use the video player plugin to play video. Go to your pubspec.yaml file in your project and add the below plugin. [java] dependencies: flutter: sdk: flutter … video_player: ^0.10.1 … [/java] Initialiaze the Controller [java] VideoPlayerController _controller; Future<void> _initializeVideoPlayerFuture; @override void initState() {… Read More »

How to load an image from the assets folder in android?

By | August 9, 2012

Here is a simple example showing how to load an image stores in assets folder in android? [java] package com.coderzheaven.pack; import java.io.IOException; import java.io.InputStream; import android.app.Activity; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.widget.ImageView; public class LoadImageFromAssetsDemo extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the AssetManager AssetManager manager = getAssets();… Read More »

How to read a folder in the assets directory and read files from it in android?

By | March 12, 2011

File reading is important in android. For the put the files in the assets folder. We can able to read foldername filename Contents of the file First we read the name of the folder. [java] private String folder_array[]; AssetManager mngr_spinner = getAssets(); try { //"air" is the name of the folder… folder_array= mngr_spinner.list("air"); } catch (IOException e1) {… Read More »

Load html string into WebView in android

By | September 13, 2010

This sample code helps you to load html from a string and from a file into webview in ANDROID. [java] String str = Your HTML String; /* use src=’file:///android_asset/images/photo_3.jpg’ for loading images from the assets /images folder */ /* To load from a string use loadDataWithBaseURL */ webview.loadDataWithBaseURL("",str , "text/html", "utf-8", ""); /* To load from a file… Read More »