Issue
I have a folder structure like this (android view):
com.sampleproject
--api
--projectname
--fragments
--Frag1.java
--adapters
--ArrayAdapter1.java
--MainActivity.java
--res
--layout
--fragment_sample.xml
--main_activity.xml
I can access fragment_sample
from MainActivity
by simply writing R.layout.fragment_sample
but the layout cannot be resolved when I try to access it from ArrayAdapter1
or Frag1
Can anyone explain why that is?
Solution
1:Make sure your ArrayAdapter1 and Frag1 have com.sampleproject.projectname.R; 2:Pass MainActivity.this to ArrayAdapter1 and Frag1.
Answered By - Andy.Zhao
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.