Professional Documents
Culture Documents
Muhammad Saad 17-Arid-5630
Muhammad Saad 17-Arid-5630
hereby declare that by attempting the paper for the course Mobile Computing___________, I
then Institute reserves the right to take any disciplinary action against me.
Student Signature
Final Exam / Fall 2020 (Paper Duration 24 hours)
(Online Assignment Based Question Paper)
Course No.: ………CS-471 ……………Course Title: ……Mobile Computing…….
………………….
Total Marks: ………20…………………Date of Exam: ……08-02-2021….…………….................
Degree: ………BSCS, BSIT ……………Semester: …………….......7th…………………..……....
Section: …………………………………
Marks
Q. No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtained
Total Marks in Words:
Name of the teacher: Rana M. Amir Latif
Who taught the course: Signature of Teacher / Examiner:
To be filled by Student
(PRACTICAL EXAMINATION)
Note:
Hand written paper will not be acceptable?
Pledger should be less than 10%
Final Exam / Fall 2020 (Paper Duration 24 hours)
(Online Assignment Based Question Paper)
Course No.: ………CS-471 ……………Course Title: ……Mobile Computing…….
………………….
Total Marks: ………20…………………Date of Exam: ……08-02-2021….………………..............
Degree: ………BSCS, BSIT ……………Semester: …………….......7th, 7th …………………..……....
Section: …………………………………
Marks
Q. No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtained
Total Marks in Words:
Name of the teacher: Rana M. Amir Latif
Who taught the course: Signature of Teacher / Examiner:
To be filled by Student
(PRACTICAL EXAMINATION)
Note:
Hand written paper will not be acceptable?
Pledger should be less than 10%
Q1:
there are some activity life cycles are as follow:
1. onCreate()
This activity is starting but this activity cannot be visible to the user.
2. onStart()
This activity can be visible to the user but this activity is not ready for the communication of
user.
3. onResume()
Now the activity is in foreground and ready to communicate with the user.
4. onpause()
In this case this activity is paused by the user and go in the background and another activity is
appear in same screen.
5. onStop()
In this case the activity is no longer available for the user.
6. onDestroy()
In this case the finish() in this activity is triggered and system wants to free up some space.
7. onRestart()
In this case it is called when the activity has stop once and then start again.
Q2:
Linear Layout:
Linear layout establish the elements the single line. We can also specify the line is horizontal or
vertical by using orientation property. By default the orientation is horizontal.
A horizontal linear layout have the only one single row of elements in the screen and vertical linear
layout have only one single child in the row.
There are various properties of the linear layout but when it about linear layout weight keep in mind
as weight is larger it will occupy more space in screen.
<Linear layout
android: orientation=”horizontal”
android: layout-with=”match-parent”
android: layout-height=”wrap-content”
>
<Button>
android: layout-with=”match-parent”
android: layout-height=”wrap-content”
android: text=”ok”
</Button>
<Textview>
android: layout-with=”match-parent”
android: layout-height=”wrap-content”
android: text=”Press OK
</Textview>
</Linear layout>
Relative Layout:
Android relative layout element depend on the relationship with parent and one another so that’s why
this layout is most complicated layout in android and we need different properties to make the layout
as we desire.
The main advantage of relative layout is that we can position a view to toLeftOf, toRightOf, above
and below to its siblings.
We can also position a view by using parent property like centered horizontal.
<RelativeLayout android:layout_width="match-parent" android:layout_height="wrap-content">
<Button
android:text="Back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_id="@id/okbutton" >
</Button>
<TextView
android:text="OK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/okbutton">
</Textview>
</Relative layout>
Q3:
The android provide various ways to store the data of the application one of them is shared
preference. Basically the shared preference allow the user to save and retrieve the data in the
form of values and key pairs.
When user use the shared preference user have to call the method of sharedPreference() and
also return this method to the instance to this file which contains the data of your method.
For example:
Sharedpreferences sharedpreferences = getsharedpreferences(datapreferences,
context.MODE_PRIVATE);
There are also some other modes in the sharedpreferences:
1. MODE_APPEND
In this mode the new preferences with the preference which is already exist
2. MODE_MULTI_PROCESS
In this method it will check out modifications for the preferences it will check the
preference even is load.
3. MODE_PRIVATE
In this mode when user set this mode it will apply only when user call its application
4. MODE_WORLD_READABLE
Simple is that this mode the allow other application read the preferences.
5. MODE_WORLD_WRITABLE
Simple is that this mode allow other application to write the preferences.
Q4:
Gravity:
Basically gravity is used to position the elements you can centered the elements according to its
parent, right to the parent, left to the parent, below the parent and top to the parent.
Padding:
Basically the padding create the distance of view and its content to the edges.
Q5:
First you have to create two activities in your project one activity is used to send data and second
activity used to save data.
EditText msgtxt;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
intent.putExtra(MESSAGE_KEY,message);
startActivity(intent);
finish();
}}
@Override
super.onCreate(savedInstanceState);
Intent i = getIntent();
textView.setTextSize(40);
textView.setText(msg);
setContentView(textView);
}
Q6: