DIR Return Create A Forum - Home
---------------------------------------------------------
Mobile AR Framework Support Forum
HTML https://mobilear.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Outdoor AR Library
*****************************************************
#Post#: 25--------------------------------------------------
"maphud cannot be resolved or is not a field" error
DIR By: richard
Date: March 7, 2013, 2:00 pm
---------------------------------------------------------
Hello, in the tutorial basic project, in the
"MapActivityView.java" there is an error like that: "maphud
cannot be resolved or is not a field". There is no variable
named "mabhud" in "R.layout.". It occured because of this code
field:
--- Code ---
protected void setupUILayout(View mapView) {
LayoutInflater controlInflater =
LayoutInflater.from(getBaseContext());
LinearLayout mapHud =
(LinearLayout)controlInflater.inflate(R.layout.maphud, null); //
this line causes the error
// Option1: Add hud on top of map view.
/*
setContentView(mapView);
addContentView(mapHud,
new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
*/
// Option2: Add map view within HUD.
mapView.getParent();
mapHud.addView(mapView);
setContentView(mapHud);
}
--- End Code ---
Also there is an error in "ARViewActivity.java" like this error.
It caused by this line in that file:
--- Code ---
LinearLayout arHud =
(LinearLayout)controlInflater.inflate(R.layout.arhud, null);
--- End Code ---
Could you help me about these errors please?
#Post#: 26--------------------------------------------------
Re: "maphud cannot be resolved or is not a field"
error
DIR By: hitlabnz
Date: March 7, 2013, 6:53 pm
---------------------------------------------------------
Hello,
It seems your are missing the resource file or the import
statement is having a problem.
1. Please make sure the following layout files are there in the
project.
- res/layout/arhud.xml
- res/layout/maphud.xml
2. Some time the import statement gets screwed up.
See if there is "import com.hitlabnz.outdoorar.R;" or import
statement of similar package end with ".R"
Delete this row, then press Cmd+Shift+O (or Ctrl+Shift+O on
Windows) to automatically reorganize the import statements.
Hope this helps you solve the problem.
:)
#Post#: 27--------------------------------------------------
Re: "maphud cannot be resolved or is not a field"
error
DIR By: richard
Date: March 10, 2013, 10:32 am
---------------------------------------------------------
Thank you, the second way worked successfully :)
*****************************************************
Page 1 of 1