1.What are the three principal data storage options in Android? Provide brief de
ID: 3804446 • Letter: 1
Question
1.What are the three principal data storage options in Android? Provide brief description for each option.
2. In the simple list: A.why it is necessary to use android:id attribute as @id/android:list rather than using @+id/ B.How this changes the way to grab the ListView widget in the relevant java class instead of using findViewById method?
3.Clarify the benefits of using DialogFragment subclass as an alternative of using dialog helper methods in the Activity class.
4.Clarify the differences between the types of location sensors built-in to the mobile device. And how the Location information is accessed within an app?
5.Illustrate the concept of how sensors and managers used to access sensor data to create a compass that calculate the device heading.
please answer all questions and write by computer..
Explanation / Answer
1. Principial data storage options in Android
Various options are provided by android for saving data. The user has his own freedom to choose according to his requirment. for ex:- whether he needs to make the data private or he wants everyone to access it or the memory he requires to store the data. The various storage options are as follows:-
a. Network Connection
Here the user can store his data on the web by using his own network server. Network should be available for this option. The user can make use of the network to store and retrieve data on the user's web based services. The packages for network connection that can be used are:-
i. java,net.*
ii. android.net.*
b. SQLite Database
SQLite is a database provided by Android. The user can create his own database and he can store structured data in it.
Android provides full support for SQLite database. Any database that we create can accessed from any application within the application but not outside it. We have an interface called SQLiteOpenHelper. We need to create sub-class of it and override the method OnCreate() where we can execute a command for creating tables in database.
The various methods of SQLiteOpenHelper are:-
i. getReadableDatabase() - to read data from database
ii. getWritableDatabase() - to write data from database
iii. SQLiteDatabase query() - to select various database query such as selection, projection, column grouping and others.
Every SQLite query will return a Cursor that points to all the rows found by the query. The Cursor is always the mechanism with which you can navigate results from a database query and read rows and column
c. Internal Storage
This is the option where the user can use his device's memory to store his private data.
For creating and writing a private file to the internal storage, call openFileOutput() This returns a FileOutputStream and then write to the file with the mehtod write(). Finally we can close the stream with the methos close().
d. External Storage
The user can use a external device which can be micro chip or a external drive to store his public data or the data he feels he can give access to everyone.
e. Shared Preferences.
It is the option where user can save the private data in key-value pair. It provides a general frameowrk for storing and retrieving data.
2.
@+id/A will create a resource ID in the application (i.e., your package) by the name "A" and gives a unique ID to it. In code, that would be R.id.A. You can change the name 'A' according to your choice.
@android:id/list will use "list" as the ID from the package android (which, in code, would be android.R.id.list)
3.
A DialogFragment is pretty similar to an Dialog, it's just wrapped inside a fragment. Fragments are a natural evolution in the Android framework due to the diversity of devices with different screen sizes. DialogFragments are made available in the support library which makes the class usable in all current used versions of Android. It can be very powerful and makes the code much cleaner. We can provide more intelligence to the dialog and make it do some smart work on its own rather than Activity telling it what to do.
4.
Android gives your applications access to the location services supported by the device through classes in the android.location package. Android gives your applications access to the location services supported by the device through classes in the android.location package.
As with other system services, you do not instantiate a LocationManager directly. Rather, you request an instance from the system by callinggetSystemService(Context.LOCATION_SERVICE). The method returns a handle to a new LocationManager instance.
Once your application has a LocationManager, your application is able to do three things:
5.
Sensor Manager lets you access the device's sensors.
Azimuth value of a device plays an important role in Compass implementation.It depends on the device's alignment.
To calculate the orientation data using the hardware sensor is straightforward. Register the sensors TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD and get the measured data.
Because these measured values are directly from source they include some heavy measuring inaccuracies. These inaccuracies are making our azimuth value unstable and unusable so we have to improve it using some proper techniques. On the one hand we can (low-pass) filter the accelerometer values On the other hand we can keep a history or rather a queue of rotation matrices and calculate the average. Then we gather orientation data using high-level sensors
Furthermore, we enhance the low-level implementation using the TYPE_GRAVITY sensor The TYPE_ROTATION_VECTOR is the jack of all sensors for measuring the devices orientation information. The data are stable and we have a great response time. It uses the accelerometer, gyroscope and magnetometer if they are available. It needs to initially orient itself and then eliminate the drift that comes with the gyroscope over time.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.