IT114 Input Output Files

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/4

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:16 PM on 3/5/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

5 Terms

1
New cards

In android studio, you want to open a file for reading. Assuming everything is set up properly for you to input a file of your choice, how is the file actually opened for reading? What is the code?

assetManager = getAssets();
Scanner fsc = new Scanner(assetManager.open(fileName));

2
New cards

How is an app given permission to access the internet? What activities should be edited?

This is done in the

app’s manifest AndroidManifest.xml by including the line:

<uses-permission android:name="android.permission.INTERNET" />


I would recommend putting this entry immediately above the beginning of the “application”

element, which starts with the line:

<application

Include the following two lines in your “onCreate” method of the Main Activity:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();

StrictMode.setThreadPolicy(policy);

3
New cards

Let’s assume you wish to write data to the file “out.txt.” To open the file for writing, use the following:

File outfile = new File(getExternalFilesDir(null), "out.txt");

FileWriter fw = new FileWriter(outfile);

BufferedWriter bw = new BufferedWriter(fw);

PrintWriter pw = new PrintWriter(bw);

4
New cards

True or False: When finished writing to a file, it’s fine to not close it.

False

I.e pw.close();

5
New cards

What happens when you try to open an app that is nonexistent for input?

Or when it’s existent for output?

App crashes.

Original app gets clobbered and replaced

Explore top notes

note
Diseases: Cause and Control
Updated 1079d ago
0.0(0)
note
Group 16 elements
Updated 1339d ago
0.0(0)
note
APUSH Unit 2
Updated 683d ago
0.0(0)
note
Physics 3.6
Updated 561d ago
0.0(0)
note
Chapter 15- Electrolysis
Updated 1271d ago
0.0(0)
note
Diseases: Cause and Control
Updated 1079d ago
0.0(0)
note
Group 16 elements
Updated 1339d ago
0.0(0)
note
APUSH Unit 2
Updated 683d ago
0.0(0)
note
Physics 3.6
Updated 561d ago
0.0(0)
note
Chapter 15- Electrolysis
Updated 1271d ago
0.0(0)

Explore top flashcards

flashcards
deelsteppen
87
Updated 1101d ago
0.0(0)
flashcards
지혜쓰 몇살이시조
198
Updated 865d ago
0.0(0)
flashcards
Lesson 12 vocab
48
Updated 435d ago
0.0(0)
flashcards
Atmosphere and Pollutants
53
Updated 689d ago
0.0(0)
flashcards
Unit 3 - Grade 9
32
Updated 371d ago
0.0(0)
flashcards
IAC Science Study Guide
51
Updated 355d ago
0.0(0)
flashcards
AP Psych Unit 5
55
Updated 1203d ago
0.0(0)
flashcards
history study guide #1 !!!
28
Updated 355d ago
0.0(0)
flashcards
deelsteppen
87
Updated 1101d ago
0.0(0)
flashcards
지혜쓰 몇살이시조
198
Updated 865d ago
0.0(0)
flashcards
Lesson 12 vocab
48
Updated 435d ago
0.0(0)
flashcards
Atmosphere and Pollutants
53
Updated 689d ago
0.0(0)
flashcards
Unit 3 - Grade 9
32
Updated 371d ago
0.0(0)
flashcards
IAC Science Study Guide
51
Updated 355d ago
0.0(0)
flashcards
AP Psych Unit 5
55
Updated 1203d ago
0.0(0)
flashcards
history study guide #1 !!!
28
Updated 355d ago
0.0(0)