Unable to resolve 'search' in R.layout.search.
Here is my code of the main activity:-
package com.example.pc.samplemap;
import android.support.v7.app.ActionBar;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.pc.samplemap.R;
import android.view.LayoutInflater;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
}
LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflator.inflate(R.layout.search, null);
if (actionBar != null) {
actionBar.setCustomView(v);
}
}
}
What is the problem here? I cleaned and rebuild the code. And yet, it says cannot resolve symbol 'search'.