Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in android studio 1- Create two activities (make them both SingleFragmentActivity subclasses) : a- SingleConversionAtivity has an EditText to enter a value, two Spinner-s (or

in android studio

1- Create two activities (make them both SingleFragmentActivity subclasses) : a- SingleConversionAtivity has an EditText to enter a value, two Spinner-s (or a similar component) to select input and output units and a label to display the converted results. Conversion output should change whenever any of the other components are changed. The output units spinner should only show units of the same dimension as the input units. Include a button, labeled All, that raises the MultiConversionActivity. b- MultiConverstionActivity has an EditText to enter a value, a Spinner (or a similar component) to select input units and a list (you can use a RecyclerView, if you like) of outputs, one for each unit that has the same dimensions as the input unit. When this activity is launched from the SingleConversionActivity, it should be pre-populated based on the inputs from that activity. When the input text or spinner changes, all outputs should update to show the correct converted result. Both activities must save their state through rotations and should re-populate with prior user inputs when the application is closed and re-launched.

2- a- You must have a top-level API that looks like: Co n v e r s i o n . from ( cm ) . t o ( i n ) . c o n v e r t ( 9 . 3 ) That is, the Conversion class has a static method from(String) that returns an object that understands to(String) that returns an object that understands convert(double) which performs the final conversion returning a double. b- You must support metric qualifiers from pico to giga and you must do it in such a way as you dont have to repeat it for each dimension. I recommend using a decorator here. c- You must support multi-step conversions so, for example, assuming you give your framework only conversion factors from inches to feet, and feet to miles, your framework must be able to covert from inches to miles. Multi-step conversion objects must have the same API as single step conversion objects. d- It must be possible to add new units by specifying a single conversion (so, for example, for lengths maybe I only need to include a method to covert a new length unit to meters so that all other units are reachable from there through multi-step conversions). e- You must throw an exception if the from and to do not match in dimension. f- You must support the following. Again, for all SI units you must support metric prefixes for all items marked with *. The name of each unit is indicated as it would be sent to from/to and a description is given in parentheses, as needed: length: m (meter*), in (inch), ft (foot), yd (yard), mi (mile), ly (lightyear) time: s (second*), min (minute), hr (hour), day (24 hours), wk (7 days), fortnight (2 weeks) energy: j (Joule*), eV (electron volt*), btu, boe (barrel of oil equivalent) power: w (Watt*), hp (horsepower), j/s (Joules per second*) mass: g (gram*), slug (stupid name for a unit) force: N (newton*), lb (pound), oz (ounce) volume: m3 (cubic meter*), li (liter*), gallon, pint, hoppus area: ft2 (square foot), m2 (square meter*), acre, are, hectare

The SingleFragmentActivity:

public abstract class SingleFragmentActivity extends AppCompatActivity { protected abstract Fragment createFragment(); @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment_host); FragmentManager fm = getSupportFragmentManager(); Fragment f = fm.findFragmentById(R.id.fragmet_container); if (f == null) { f = createFragment(); fm.beginTransaction() .add(R.id.fragmet_container, f) .commit(); } } } 

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 Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

I am paid fairly for the work I do.

Answered: 1 week ago

Question

I receive the training I need to do my job well.

Answered: 1 week ago