Course Content

Course Content

Description

Widgets In Android

 

Now we will see what are Widget in Android and how it works.

 

There are Four types of Widgets in Android Studio.

 

1. Information Widget

 

The first widget in android is the information widget. Its task is to display information in short. It has the work of displaying things directly on the screen without using any different application, such as Weather, Time, etc...

 

2. Collection Widget

 

The second widget in Android is the Collection Widget, which is a special kind of collection that helps us to display similar elements, like in our phone gallery, we have a different collection of pictures, or else in our email, we can collectively view all emails together in that single application.

 

Collection Widgets can scroll vertically and Collection widgets typically focus on two use cases -

  • Browsing the collection.
  • Opening the element of the collection to its detail view for consumption, For example- Gmail, Gallery.

3. Control Widget

 

The next Widget in Android is Control Widget. In spite of going in a particular application, we can also use it by scrolling on our screen, for example, Wifi.

 

4. Hybrid Widget

 

We can call Hybrid Widget a combination of different elements. For example, the music application where we are also using the music widget and the song is also playing, and in this, we can also keep the information of which song we are playing. So in this way, it is a combination of elements.

 

Intent

 

Intents are used to move from activity to activity intent describes what the application wants to do consists of –

  • Action to be performed (MAIN,VIEW,EDIT,PICK,DELETE…)
  • Categories
  • Data to act on (URI)
  • Extras (primitives/primitives[]/strings/serializable)
  • Flags

It provides runtime binding between the code in different applications. They are basically used to :

  • Launch an Activity
  • Start Services
  • Broadcast data between components

Intent Object

 

An intent object is a bundle of informations which is used by the component that receives the intent as well as the information used by the Android System.

 

Basically there are two types of intents objects . Here below mentions are Intents.

 

Types of Android Intents Object-

 

1. Implicit Intent in Android

 

Simply said, when we want to use some readymade code in our application, then we will use implicit intent.

 

For example: Following code to view the webpage.

 

new Intent(Intent.ACTION_VIEW);

intent.setData(Uri.parse(http://www.google.com));

startActivity(intent);

 

2. Explicit Intent in Android

 

When we want to apply some user defined thing in our application, then we will use Explicit intent.

 

For example: Suppose if you want to connect one activity to another activity, we can do this quote by explicit intent.

 

Intent i = new Intent(FirstActivity.this, SecondActivity.class);

startActivity(i);

 

Fragment

 

It will not be wrong if we say, a Fragment is a kind of sub-activity.

 

Meaning that as soon as the activity life cycle goes on, the life cycle of the fragment will run accordingly.

 

Fragments were added to the Android API in Honeycomb version of Android which is API version 11.

FAQs

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere