Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you do this java question DOING D43 DASc - The Activity-View Connection We have 4 bunons in our 11 so we can gluc them

Can you do this java question
image text in transcribed
DOING D43 DASc - The Activity-View Connection We have 4 bunons in our 11 so we can gluc them to 4 methods in our Fille Constructor public File(File directory, String name) Construct an instance in the given directory having the given name File Methods activity d public vold onEncrypt(VLen v) . - public void onDecrypt(View v) public void onSavecien v) public void onloadcyVien v public long JastModi tied Returns the time at which the file of this instance was last modified lthe number of miliseconds since the epoch, Jan 1, 1970 The needed code in the fiest reo methods involves creating a Cipher in entered key to it), imvoking eather encrypt sand decrypt, and then poking the renum dato restbox. Enclose the lbody with try-cotch construct The nceded oode in the last two methods involves leveraging the fle API th heblighted in the design sechioo. The details are discussed in the next section public long Jengtho Returns the size (in bytes) of the file of this instance public stringt) 1ist Returns an array of the names of all files and directories in this instance D43d -File 1/0 Wntingto s file envulves the following sequence of steps t Deermune the directory to create the file in 2 Create s new file with the given name To implement the remaining steps, we examine the File riter AP FlleWriter Constructor Creste a fle wniter Write the dara to the file public Filewriter File nane Construct an instance that can write to the given fle Throws on exception if the instance connot be created public Fileriter Filen Construct an instance that can write to the given file Throws an exception if the instance connot be created FileWriter Methods 5 Chse the file writer The fiest step s c thanks to a method that is already available in our activin Activity Methods public Fsle getFilesDir Returns a reference to a File instance that points at the directory n etenal storage area) that is set aside for our app public void weiteSering data) Writes the given string to the file Hence, our onsove method would start like thi Throws on exception if the operation connot be completedt String rene. CCEditText, findireyld(R, d. file). getTexto. to Fite dir - this.getFitesbirO: any buffered data and disconnects the code from the on esception if the operation connot be completed heit tatement captures the entered flename and the second captures the dircte the entensl stotag stes in which our spp can crate is own filkes For Step 2, we camte the File APl shown belkow and then appen ody of or o festures in this API throw esceptions, we sandwich the entre b e above on Fite file-new Fllecdir, none))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Identify the universal properties of all languages.

Answered: 1 week ago

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago