0% found this document useful (0 votes)
10 views1 page

Mobile Programming Quick Notes

The document provides quick notes on mobile programming, focusing on the Android activity lifecycle, key components such as Activity and Service, and the use of intents for navigation. It also covers layout types, SQLite database examples, permissions, and a comparison between Android and iOS. Additionally, it includes sample code for handling button clicks to display text.

Uploaded by

dubsmashking981
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Mobile Programming Quick Notes

The document provides quick notes on mobile programming, focusing on the Android activity lifecycle, key components such as Activity and Service, and the use of intents for navigation. It also covers layout types, SQLite database examples, permissions, and a comparison between Android and iOS. Additionally, it includes sample code for handling button clicks to display text.

Uploaded by

dubsmashking981
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Mobile Programming - Quick Notes

Mobile Programming - Quick Notes

1. Activity Lifecycle (VERY Important):


onCreate() -> onStart() -> onResume() -> [Running]
-> onPause() -> onStop() -> onDestroy()

Simple Nepali:
- onCreate(): App ■■■■ ■■■■■ ■■■■■ function ■■■
- onStart(): User ■■■ ■■■■■■ ■■■■ ■■■■■■■■
- onResume(): User ■■ interact ■■■■ ■■■■■
- onPause(): ■■■■■ activity ■■■■■■■
- onStop(): ■■ screen ■■ ■■■■■■■■■
- onDestroy(): Memory ■■■ ■■■■■■■■

2. Android Components:
- Activity: UI screen
- Service: No UI, runs in background
- BroadcastReceiver: Respond to system messages
- ContentProvider: Share data between apps

3. Intents:
Explicit:
Intent i = new Intent(this, [Link]);
startActivity(i);

Implicit:
Intent i = new Intent(Intent.ACTION_VIEW);
[Link]([Link]("[Link]
startActivity(i);

4. Layouts:
- LinearLayout: Vertical/horizontal line
- RelativeLayout: Position based on other items
- ConstraintLayout: Modern, flexible

5. SQLite Example:
SQLiteDatabase db = openOrCreateDatabase("StudentDB", MODE_PRIVATE, null);
[Link]("CREATE TABLE IF NOT EXISTS student(id INTEGER, name TEXT);");
[Link]("INSERT INTO student VALUES(1, 'Bibek');");

6. Permissions:
<uses-permission android:name="[Link]"/>

7. Android vs iOS:
Android: Open-source, Java/Kotlin, many devices
iOS: Closed, Swift, Apple only

8. Sample Code: Button click to show text:


Button b = findViewById([Link]);
TextView t = findViewById([Link]);
[Link](v -> [Link]("Button Clicked"));

You might also like