Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a txt file into your android project? [duplicate]

Tags:

java

android

I have version 1.5.1 of Android studio. Apparently this never version doesn't have an asset folder for txt files. How are you suppose to includes these files into you project? And how to further use the within you application? Thanks for your advice

like image 588
Wrestling with Android Avatar asked Jan 16 '16 17:01

Wrestling with Android


People also ask

Can I duplicate a project in Android Studio?

Select Project Details under the project's thumbnail. Select the More menu. Select Duplicate.

How do I copy one Android project to another?

Select your project then go to Refactor -> Copy... . Android Studio will ask you the new name and where you want to copy the project. Provide the same. After the copying is done, open your new project in Android Studio.

How do I add an existing project to Android Studio?

Launch Android Studio, and click File > New > Import Project. Locate your project directory, click the build. gradle file you created above to select it, and then click OK to import your project.

What is the file extension for Android project?

An Android App Bundle is a file (with the . aab file extension) that you upload to Google Play.


2 Answers

You can go to New->add folder -> assets folder and the folder will automatically be put in the right place.
Please reference the following where I got this answer -- it also includes a screenshot: Adding an assets folder in Android Studio

To access something from the assets folder in your application you need to use the AssetManager:

Please refer to the following for a full example:

How to access file under assets folder?

like image 183
Alan S. Avatar answered Oct 27 '22 07:10

Alan S.


Project window, press Alt-Insert, and select Folder->Assets folder. Android Studio will add it automatically to the correct location.

And then you can add your assets or/txt files(whatever you want) on it.

like image 40
ʍѳђઽ૯ท Avatar answered Oct 27 '22 08:10

ʍѳђઽ૯ท