Android: What is used for?

findviewbyid( returns null
getfragmentmanager begintransaction add android r id content details commit
android r id title
findviewbyid(r id)
r id field
r id textview
id in android
no view found for id 0x1020002 (android:id/content) for fragment

Anybody could explain the meaning of "" ?

How is it being used ? does not have any explanation.

public static final int content Since: API Level 1

Constant Value: 16908290 (0x01020002)

As Philipp Reichart commented: gives you the root element of a view, without having to know its actual name/type/ID. Check out as container for Fragment, there is nothing wrong with it. Like you said: you dont need your extra​content layout so just don't add it with setContentView. There is even mention about  Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

The ID value indicates the ViewGroup of the entire content area of an Activity.

It can be used with Fragment:

public class MyActivity extends Activity {

    protected void onCreate(Bundle savedInstanceState) {

        if (savedInstanceState == null) {
                .add(, MyFragment.newInstance())



The code above will insert the View created by Fragment into the ViewGroup identified by

Android: What is used for?, The ID value indicates the ViewGroup of the entire content area of an Activity. A unique resource name for the element, which you can use to obtain a reference to the ViewGroup from your application. See more about the value for android:id below. android:layout_height

Google designers develop Android UX with specific or recommended design guidelines. The layout defines a linearlayout with a few attributes Android believes are a good standard.

Thus loading a Fragment Manager's root view with ensures these guidelines are implemented.

NOTE: This layout has set the attribute: android:addStatesFromChildren="true" to allow child fragments to overwrite attributes in this rootview.

As of version 19, is defined in a file: auto_complete_list.xml

<LinearLayout xmlns:android="" 
    android:addStatesFromChildren="true">, Context menu ID for the "Paste" menu item to copy the current contents of the clipboard into the text view. int, pasteAsPlainText. int, primary. int  With Android, you get two different types of screen readers. You can use your device without ever needing the screen using TalkBack. Or you can tap on certain elements, like notifications or buttons, and have them read using Select to Speak. If it’s on your screen, Android can read it to you.

Layout resource, The filename will be used as the resource ID. compiled resource to a View (or subclass) resource. resource reference: In Java: R.layout.filename the dimension only to the size required to fit the content of this element. App resources overview Resources are the additional files and static content that your code uses, such as bitmaps, layout definitions, user interface strings, animation instructions, and more. You should always externalize app resources such as images and strings from your code, so that you can maintain them independently.

What is '' in Android?, is Automatically System generated file it contains the id of each resources used in Application which is used to make refrence. R.class contains IDs for all  Android Automotive is a base Android platform that runs pre-installed IVI system Android Applications as well as (optional) second- and third-party Android Applications.

What does mean in java?, In Android programming, the file creates an object with resource IDs for all of the resources your application uses. This includes drawables, layouts,  I was able to get to the contents of an Activity with this call: ViewGroup view = (ViewGroup)getWindow().getDecorView(); You should probably check that getDecorView returns an instanceof ViewGroup for all cases, but with a LinearLayout in the Activity the code above runs fine.

  • gives you the root element of a view, without having to know its actual name/type/ID. Check out…
  • This is useful in fragment transactions like: mFragmentTransaction.add(, myFragment);
  • @IgorGanapolsky An example app performs this kind of transaction in a conditional:if(fragmentManager.findFragmentById( {fragmentManager.beginTransaction(, list).add().commit();} Can you tell which View's root element is this?
  • @Zarah Are you sure your syntax is correct here and compilable?
  • What is the class of the layout associated with ?
  • A practical example of it's use can be found in paragraph 2:
  • "gives you the root element of a view, without having to know its actual name/type/ID" How does it know which view is it that we want the root element of.