Issue
I have the following file which cannot be recongized by R. The unrecognized file is arrow2.png. The code is as following
in pkg2
Marker instructionMarker = mMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow2)) //This is where it fails to recognize resource
.flat(true)
.position(instructionAnchorPoint)
.snippet(instruction+"--"+distance));
The File directory as following
project
/src
/pkg1_mainpkg
some java files
/pkg2
some java files
/pkg3
some java files
/gen
/pkg4
R.java
/pkg1_mainpkg
R.java (contains the id for "arrow2", defined as **public static final int arrow2=0x7f020000;**)
/res
/drawable-hdpi
arrow2.png
...
/drawable-ldpi
arrow2.png
...
/drawable-mdpi
arrow2.png
...
/layout
/values
Solution
you are probably importing android.R.
you need to import your project package like
import com.example.yourproject.R;
Answered By - Claudio Jundi Sassaki
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.