M. Schneider
M. Schneider

Reputation: 21

Cannot resolve the symbol fragment_main

i´ve started to learn developing android apps with Android Studio with an tutorial and now i´ve got a problem in my MainActivityFragment.

Here´s the code

    return inflater.inflate(R.layout.fragment_main, container, false);

The problem lies in: return inflater.inflate(R.ayout.fragment_main, container, false)

fragment_main is red underlined and Android Studio says: "cannot resolve the Symbol"fragment_main"

Upvotes: 2

Views: 864

Answers (2)

Mohammed Aouf Zouag
Mohammed Aouf Zouag

Reputation: 17132

You are missing an 'l':

return inflater.inflate(R.layout.fragment_main, container, false);
// -----------------------^

And make sure that you have a fragment_main.xml layout file in your res/layout directory.

EDIT:

Change

import android.R;

to

import com.example.martin.myapplication.app.R; // or ...myapplication.R

Upvotes: 2

TeChNo_DeViL
TeChNo_DeViL

Reputation: 739

There is no values such as R.ayout.something

return inflater.inflate(R.ayout.fragment_main, container, false)

Just make it R.layout.fragment_main , like

return inflater.inflate(R.layout.fragment_main, container, false);

Provided the layout resource fragment_main.xml exists in res/layout/ folder, it should work fine.

Upvotes: 0

Related Questions