Posts

Showing posts from November, 2024

All about Fragment in Android

Image
Hello friends hi. This post is regarding all about Fragment in Android. Fragment is also one of the most important and useful topic in Android. So in this post we will learn the following points about Fragment... 1)- What is Fragment? 2)- What is the lifecycle of Fragment? 3)- How to implement Fragment? 4)- Difference between Activity and Fragment? These points are also very important for any interview..... So let's get start.... 1)- So the first point is what is Fragment? The answer is quite simple, A Fragment is a part of an Activity. It is also called as the sub-activity with their own lifecycle. There can be more than one Fragment in an Activity and the fragment lifecycle is affected by the activity lifecycle. 2)- What is the lifecycle of Fragment? Fragment lifecycle can be demonstrate using the following picture.... 3)- How to implement Fragment? *** Basic code in XML: <fragment android:id = "@+id/fragments" android:layout_width = "match_parent" andro...

Pending Intent in Android

Hello friends hi. This post is regarding all about Pending Intent in Android. Here are the main points about Pending Intent... 1)- What is Pending Intent? 2)- What are Pending Intent constants? 3)- How to create Pending Intent for Broadcast Receiver? 4)-  How to create Pending Intent for Activity? 5)-  How to create Pending Intent for Service? 6)- What are the main purpose of request code parameter in Pending Intent? 7)- How to cancel a Pending Intent? 8)- What is the use case of Pending Intent in Notification? 9)- How to pass extra data with a Pending Intent? 10)- What happen if we create two Pending Intent with same request code and  activity? These above question are the most important for not only the development but also for the interview purpose... So let's get start.... 1)- What is Pending Intent? In simple words, a Pending Intent can be  defined as "A description of an Intent and the target  action perform with it." On the other hand, A pending Int...

Content Provider in Android

Image
Hello friends hi. This post is regarding all about Content Provider in Android. Content Provider is also one of the most important topic of  Android Application. So let's get start.... Basically a Content Provider manages access to a structured set of data. It encapsulate the data and  the mechanism for defining data security. It is used to share the data between different applications. Content Providers   support the  four  basic operations, normally called  CRUD - operations. What is Content URI  ( Universal Resource Identifier )? Content URI is the key concept of content provider. To query a content provider, you can specify the query string in the form of URI. URI:  content://authority/data_type/id content://  →  This is prefix of all the URI and it is mandatory part of URI. authority  →  This part should be always unique for every content provider, it specify the name of content provider. for example contacts, browser etc....