MDA Final

¡Supera tus tareas y exámenes ahora con Quizwiz!

What are the types of location permissions?

ACCESS_FINE_LOCATION : Fine location is the GPS radio ACCESS_COARSE_LOCATION : coarse location is derived from cell towers or WiFi access points.

Which methods has to be implemented (overridden) when we extend SQLiteOpenHelper

Constructor, onCreate(SQLiteDatabase db), onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)

How do we add a dependent library in Android Studio?

File → Project Structure.... Select the app module on the left, then the Dependencies tab.

What is the benefit of User Interface testing?

User interface (UI) testing lets you ensure that your app meets its functional requirements and achieves a high standard of quality such that it is more likely to be successfully adopted by users.

theme

a collection of styles. Structurally, a theme is itself a style resource whose attributes point to other style resources.Android provides platform themes that your apps can use.

What are the steps of Espresso Tests?

1.Access UI Components 2.Perform Actions 3.Verify Results

What are the rules for creating a constraint layout?

1.Every view must have at least two constraints: one horizontal and one vertical. 2.You can create constraints only between a constraint handle and an anchor point that share the same plane. So a vertical plane (the left and right sides) of a view can be constrained only to another vertical plane; and baselines can constraint only to other baselines. 3.Each constraint handle can be used for just one constraint, but you can create multiple constraints (from different views) to the same anchor point.

What are the UI testing approaches?

1.Manually test a set of user operations on the target app and verify that it is behaving correctly. (time-consuming, tedious, and error-prone). 2.Write your UI tests such that user actions are performed in an automated way. The automated approach allows you to run your tests quickly and reliably in a repeatable manner.

What are the shortcoming of SQLite APIs? What kind of benefits does Room persistence library provide?

1.No compile-time verification of raw SQL queries 2.When schema changes, requires manual updates 3.Need to write code to convert between SQL queries and Java data objects

What are the types of UI tests?

1.UI tests that span a single app: Verifies that the target app behaves as expected when a user performs a specific action or enters a specific input in its activities. It allows you to check that the target app returns the correct UI output in response to user interactions in the app's activities. (Espresso) 2.UI tests that span multiple apps: Verifies the correct behavior of interactions between different user apps or between user apps and system apps. For example, you might want to test that your camera app shares images correctly with a 3rd-party social media app, or with the default Android Photos app. (UI Automator)

Parsing JSON text

A JSON object is a set of name-value pairs enclosed between curly braces, { }. A JSON array is a comma-separated list of JSON objects enclosed in square brackets, [ ].

Which types of files can we have in the external storage? Explain these types

After you request storage permissions and verify that storage is available, you can save two different types of files: •Public files: Files that should be freely available to other apps and to the user. When the user uninstalls your app, these files should remain available to the user. For example, photos captured by your app or other downloaded files should be saved as public files. •Private files: Files that rightfully belong to your app and will be deleted when the user uninstalls your app. Although these files are technically accessible by the user and other apps because they are on the external storage, they don't provide value to the user outside of your app.

What are 2 main classes that recyclerview works with to get UI elements on the screen what are their responsibilities?

An adapter is a controller object that sits between the RecyclerView and the data set that the RecyclerView should display. The adapter is responsible for:•Creating the necessary ViewHolders•Binding ViewHolders to data from the model layerA ViewHolder describes an item view and metadata about its place within the RecyclerView.

What are the 3 major components in Room Library? Explain them

Database: Contains the database holder and serves as the main access point for the underlying connection to your app's persisted, relational data. The class that's annotated with @Database should satisfy the following conditions: •Be an abstract class that extends RoomDatabase. •Include the list of entities associated with the database within the annotation. •Contain an abstract method that has 0 arguments and returns the class that is annotated with @Dao. At runtime, you can acquire an instance of Database by calling Room.databaseBuilder() or Room.inMemoryDatabaseBuilder(). Entity: Represents a table within the database. DAO: Contains the methods used for accessing the database.

What is Google Play Services?

Google Play Services is a set of common services that are installed alongside the Google Play Store application. •Because these libraries live in another application, you must actually have that application installed. This means that only devices with the Google Play Store app installed. •This almost certainly means that your app will be distributed through the Play Store, too.

Where/how do we let Android system know about the Activity that our app will start?

Inside AndroidManifest.xml<applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:theme="@style/AppTheme" ><activity android:name=".CrimeListActivity"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></activity></application>

Which storage devices can you use for storing files locally? Compare them.

Internal: •It's always available. •Files saved here are accessible by only your app. •When the user uninstalls your app, the system removes all your app's files from internal storage. External storage: •It's not always available. •It's world-readable, so files saved here may be read outside of your control. •When the user uninstalls your app, the system removes your app's files from here only if you save them in the directory from getExternalFilesDir()

Parsed Text

JSONObject that maps to the outermost curly braces in the original JSON text. This top-level object contains a nested JSONObject named photos. Within this nested JSONObject is a JSONArray named photo. This array contains a collection of JSONObjects, each representing metadata for a single photo.

Explain what would be difference when the following two code are executed? Show the difference by drawing it.

LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);

Setting Up Your Map

Maps are displayed in a MapView. MapView is like other views, mostly, except in one way: For it to work correctly, you have to forward all of your lifecycle events, like this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMapView.onCreate(savedInstanceState); }

What is Mockito, describe?

Mockito is a mocking framework that enables us to write clean tests in java. It simplifies the process of creating test doubles (mocks), which are used to replace the original dependencies of a component/module used in production.

dp(or dip) density-independent pixel

One dp is always 1/160th of an inch on a device's screen. You get the same size regardless of screen density

px(pixel)

One pixel corresponds to one onscreen pixel, no matter what the display density is.

Which class do we extend to create a database helper class as we utilize a SQLite DB for persistent storage?

SQLiteOpenHelper

What are the persistent data options on Android. What are their features/important points?

Shared Preferences •Easily save basic data as key-value pairs in a private persisted dictionary. •The key-value pairs are written to XML files that persist across user sessions, even if your app is killed. •Used for app preferences, keys and session information. Local Files (Internal, External) •Save arbitrary files to internal or external device storage. •Often used for blob data or data file caches SQLite Database •Persist data in tables within an app specific database. •Used for complex data manipulation or for raw speed ORM (Object-relational mapping) •Describe and persist model objects using a higher level query/update syntax. •Used to store simple relational data locally to reduce SQL boilerplate

Describe Testing Pyramid?

Smalltests are unit tests that you can run in isolation from production systems. They typically mock every major component and should run quickly on your machine. Mediumtests are integration tests that sit in between small tests and large tests. They integrate several components, and they run on emulators or real devices. Large tests are integration and UI tests that run by completing a UI workflow. They ensure that key end-user tasks work as expected on emulators or real devices.

What is Espresso and what are the benefits of using it?

The Espresso testing framework provides APIs for writing UI tests to simulate user interactions within a single target app. Provides automatic synchronization of test actions with the UI of the app you are testing: •Espresso detects when the main thread is idle, so it is able to run your test commands at the appropriate time, improving the reliability of your tests. •This capability also relieves you from having to add any timing workarounds, such as Thread.sleep() in your test code.

How do we ask permission to access network?

To ask permission to network, add the following permission to your AndroidManifest.xml. <manifestxmlns:android="http://schemas.android.com/apk/res/android"package="com.bignerdranch.android.photogallery" ><uses-permission android:name="android.permission.INTERNET" /><application... </application> </manifest>

Getting a Location FixGetting a Location Fix

To get a location fix from this API, you need to build a location request. Fused location requests are represented by LocationRequest objects. Create one and configure it in a new method called findImage() inside LocatrFragment.java.

Adding a Webview

Two ways: •Include the <WebView> element in your activity layout, •Set the entire Activity window as a WebView in onCreate().

What is Unit Testing? What are its phases?

Unit test is a method that instantiates a small portion of our application and verifies its behavior independently from other parts. It has 3 phases: 1.It initializes a small piece of an application it wants to test, 2.It applies some stimulus to the system under test (usually by calling a method on it), 3.It observes the resulting behavior. If the observed behavior is consistent with the expectations, the unit test passes, otherwise, it fails.

Instrumented tests

Unit tests that run on an Android device or emulator. These tests have access to instrumentation information, such as the Context for the app under test. Use this approach to run unit tests that have complex Android dependencies that require a more robust environment, such as Robolectric.

Local tests

Unit tests that run on your local machine only. These tests are compiled to run locally on the Java Virtual Machine (JVM) to minimize execution time. If your tests depend on objects in the Android framework, we recommend using Robolectric. For tests that depend on your own dependencies, use mock objects to emulate your dependencies' behavior.

Device's Browser

Using Implicit IntentIntent i = new Intent(Intent.ACTION_VIEW, URLString);startActivity(i);

Describe Test Driven Development?

When developing a feature iteratively, you start by either writing a new test or by adding cases and assertions to an existing unit test. The test fails at first because the feature isn't implemented yet.

ConstraintLayout

With ConstraintLayout, instead of using nested layouts you add a series of constraints to your layout. A constraint is like a rubber band. It pulls two things toward each other

style

XML resource that contains attributes that describe how a widget should look and behave. Example:<style name="BigTextStyle"><item name="android:textSize">20sp</item><item name="android:padding">3dp</item></style>

Binding JavaScript code to Android codeBinding JavaScript code to Android cod

You can create interfaces between your JavaScript code and client-side Android code. public class WebAppInterface { Context mContext; WebAppInterface(Context c) { mContext = c; } @JavascriptInterface public void showToast(String toast) { Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show(); } }

The following is the default directory structure for your application and test code

app/src/main/java- for your source code of your main application build app/src/test/java - for any unit test which can run on the JVM app/src/androidTest/java- for any test which should run on an Android device

While saving data using sharedpreferences you can save the change either apply() or commit(). What is the difference between these two methods?

apply() changes the in-memory SharedPreferences object immediately but writes the updates to disk asynchronously. Alternatively, you can use commit() to write the data to disk synchronously.But because commit() is synchronous, you should avoid calling it from your main thread because it could pause your UI rendering.

Padding

attribute tells the widgethow much bigger than its contents it should draw itself.

Margin

attributes are layout parameters. They determine the distance between widgets. Responsibility of the widget's parent

When should we use special cache directory of Android? How can we put files in the cache directory?

f you'd like to keep some data temporarily, rather than store it persistently, you should use the special cache directory to save the data. •Each app has a private cache directory specifically for these kinds of files. When the device is low on internal storage space, Android may delete these cache files to recover space. When the user uninstalls your app, these files are removed. •Files created with createTempFile() are placed in a cache directory that's private to your app. You should regularly delete the files you no longer need.try { String fileName = Uri.parse(url).getLastPathSegment(); file = File.createTempFile(fileName, null, context.getCacheDir()); } catch (IOException e) { // Error while creating file }

Drawing on the map

mMap.addMarker(MarkerOptions)

sp(Scale-Independent Pixel)

use sp to set display text size

JSON Format

•Curly braces hold objects and each name is followed by ':'(colon), •Data is represented in name/value pairs. •The name/value pairs are separated by , (comma). •Square brackets hold arrays and values are separated by ,(comma).

What is JSON? Describe.

•It was designed for human-readable data interchange. •JSON format is used for serializing and transmitting structured data over network connection. •It is primarily used to transmit data between a server and web applications. •JSON is easy to read and write. •It is a lightweight text-based interchange format. •JSON is language independent.

Building web apps in WebView

•Use Webview to deliver a web application (or just a web page) •WebView allows you to display web pages as a part of your activity layout. •Not a browser; does not include as navigation controls or an address bar. •Scenarios: •Provide frequently updated information, such as an end-user agreement or a user guide •If your app provides data to the user that always requires an Internet connection to retrieve data, such as email


Conjuntos de estudio relacionados

Intercultural Communication Quiz Answers

View Set

Plates of associated structures of ethmoid bone

View Set

Suspense and Horror: Gothic Writing across Time

View Set