Android Workshop
Android Workshop
High Success
Ratio Best Dev. Tools
Larger
Market Scale Community
Where Android Is?
Cars Smart TV
Pre-Requirements to Learn Android
• Core Java
• Kotlin (optional)
• OOP’s
e written in Java
Many core Android system Devices which run 5.0 or higher, each app runs in its own
components and services, process and with its own instance ART. ART is written to
are built from native code run multiple virtual machines on low-memory devices by
that require native libraries executing DEX files,
written in C and C++.
• Frame Layout
• Table Layout
android:rotationX="45"
android:rotationY="45"
android:alpha="0.5"
/>
ImageView
<ImageView
android:id="@+id/id_img_imgName"
android:layout_width="320dp"
android:layout_height="320dp"
android:layout_gravity="center"
android:adjustViewBounds="false"
android:alpha="0.5"
android:scaleType="fitXY"
android:src="@drawable/ic_android"
android:contentDescription="android
image" />
Button
<Button
android:id="@+id/id_button_buttonName"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:text="Submit"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="italic"
android:background="@drawable/button_back“
/>
Add Data-Binding
Data Binding is Nothing but binding data to xml view directly without finding of id of them
buildFeatures {
dataBinding true
}
<CheckBox
android:id="@+id/id_check_android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android"
android:buttonTint="#0000ff"
android:checked="true" />
binding.idButtonSubmit.setOnClickListener(v -> {
courses.clear();
if(binding.idCheckAndroid.isChecked())
{
courses.add("Android");
}
}
Radio Button
<RadioGroup
android:id="@+id/id_radio_grp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="30dp"
android:layout_gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/id_button_male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:buttonTint="#0000ff"
android:checked="true"
/>
</ RadioGroup>
Listeners,
RadioButton.setOnCheckedChangeListener()
RadioGroup.
setOnCheckedChangeListener()
Spinner
<Spinner
android:id="@+id/id_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/course_list"
android:padding="30dp"
android:spinnerMode="dialog || dropdown“
/>
Spinner .
setOnItemSelectedListener()
CardView
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="240dp"
android:layout_margin="30dp"
app:cardBackgroundColor="#e5e5e5"
app:cardCornerRadius="36sp"
app:cardElevation="8dp"
android:rotation="-45“
/>
Toolba
r
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_500"
app:navigationIcon="@drawable/ic_arrow_toleft"
app:navigationContentDescription="@string/app_na
me" app:logo="@drawable/ic_android"
app:title="Title"
app:titleTextColor="@color/white"
app:subtitle="Sub Title"
app:subtitleTextColor="@color/white"
app:titleMarginStart="30dp"
app:menu="@menu/menu“ />
RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/id_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layoutManager=".LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:itemCount="10"
tools:listitem="@layout/raw_layout" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/id_viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal | Verticle"
/>
Adapter
@NonNull @Override
public Fragment createFragment(int position) {
return new TestFragment(); }
@Override
public int getItemCount() { return 8; }
}
Navigation Drawer
Toolbar
-> DrawerLayout
-> NavigationView
-> Header
-> Menu
setSupportActionBar(binding.idToolbar);
Override 2 Mothods
onCreateOptionMenu() getMenuInflater().inflate(R.menu.menu,menu);
Listeners : setOnItemSelectedListener()
Activity
- An activity is the entry point for interacting with
the user. It represents a single screen with a user
interface, You implement an activity as a subclass
of the Activity Class
- Lifecycle
- Activities overridden Methods
- Intent for
- New Activity
- Open Messaging App
- Open Gmail
- Open Phone App
- Open Camera
- Open Gallery
- StartActivityForResult
- Share Text
• What is Backstack?