Posts

How to remove ActionBar from Android Activity

Just change the parent in style.xml to NoActionBar as shown in example <resources>     <!-- Base application theme. -->     <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">         <!--   your app branding color for the app bar -->         <item name="colorPrimary">#3F51B5</item>         <!--   darker variant for the status bar and contextual app bars -->         <item name="colorPrimaryDark">#303F9F</item>         <!--   theme UI controls like checkboxes and text fields -->         <item name="colorAccent">#FF4081</item>     </style> </resources>

What's the role of adapters in Android?

Well adapters in Android are basically a bridge between the UI components and the data source that fill data into the UI Component For example, Lists (UI Component) get populated by using a list adapter, from a data source array. Let’s assume you want to display a list in your Android app. For this you will use the  ListView provided by Android.  ListView s don’t actually contain any data themselves. It’s just a UI element without data in it. You can populate your  ListView s by using an Android adapter. Adapter  is an interface whose implementations provide data and control the display of that data.  ListView s own adapters that completely control the  ListView ’s display. So adapters control the content displayed in the list as well as how to display it.

Difference Between View and ViewGroup

View View  objects are the basic building blocks of User Interface(UI) elements in Android. View  is a simple rectangle box which responds to the user's actions. Examples are  EditText ,  Button ,  CheckBox  etc.. View  refers to the  android.view.View  class, which is the base class of all UI classes. ViewGroup ViewGroup  is the invisible container. It holds  View  and  ViewGroup For example,  LinearLayout  is the  ViewGroup  that contains Button(View), and other Layouts also. ViewGroup  is the base class for Layouts.

What is Inflater in Android

To summarize what the  LayoutInflater Documentation  says... A  LayoutInflater  is one of the Android System Services that is responsible for taking your XML files that define a layout, and converting them into  View  objects. The OS then uses these view objects to draw the screen. Typically, you don't ever need to directly use a LayoutInflater. Android does most of the layout inflation for you when you call  setContentView()  in the  onCreate()  method of your activity.  So you, as the programmer, are responsible for making sure the views are inflated . Now you want to inflate views in the context of a ListView. The Adapter class can do the inflation for you if you do not want to customize each item. But if you want to customize the views shown in a list, you will have to manually inflate each view with the LayoutInflater, since there is no other existing method you can use. There is no advantage to using it. You are requir...