I am creating a simple Android Bible app. Bible text is structured in the bible
folder as:
.
├── bible
│ ├── book_one
│ │ ├── chapter_one.html
│ │ ├── chapter_two.html
│ │ └── [...]
│ ├── book_two
│ │ ├── chapter_one.html
│ │ ├── chapter_two.html
│ │ └── [...]
│ ├── [...]
| [...]
[...]
My question are:
- where is the appropriate place to put the
bible
folder in Android app project and, - how do I import it with the Android Studio (version Artic Fox) and,
- how do I load those files to use it within my code?
P.S. I’m new in the Android app dev world.
2
Answers
Step 1: Create an HTML page anywhere on your PC and then copy the required HTML files.
Step 2: Paste it inside the assets folder by right-clicking on the assets folder as shown in the below image.
Please check this image
In order to put HTML files in your existing android studio project please follow steps below:
1: To add a local HTML file into your Android project there must be an asset folder in it. To create an asset folder in Android studio open your project in Android mode first as shown in the below image.
2: Go to the
app > right-click > New > Folder > Asset
Folder and create the asset folder.3: Android Studio will open a dialog box. Keep all the settings default. Under the target source set, option main should be selected. and click on the finish button.
4: The asset folder has been created as shown in the below image. Go to
assets > right-click > New > File
and a dialog box will pop up.5: Provide a name to your file as shown below. For example
demo.html
6: Or you can simply paste your html files into assets folder created in step 4.
7: You are done with it! Happy Coding
8: This way you can use your files from Assets folder: