Reputation: 9726
Trying to make the Fragments example work on lower than 11 SDK, I get an error in
setListAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_activated_1, Shakespeare.TITLES));
saying "simple_list_item_activated_1" cannot be resolved or is not a field". In import i have
import com.example.android.apis.R;
import com.example.android.apis.Shakespeare;
What wrong is in here?
Upvotes: 5
Views: 6719
Reputation: 10415
If you installed Samples through SDK MANAGER you can find it through samples directory of your android installation directory. e.g. in my computer Shakespeare implementation is located here:
C:\Program Files\Android\android-sdk\samples\android-13\ApiDemos\src\com\example\android\apis\Shakespeare.java
you can simply copy it to your source files folder.
Upvotes: 0
Reputation: 10415
You can follow below path in eclipse to import sample applications into your workspace:
File => New => Android => Android Sample Project
Here you should select android platform which you installed its sample e.g. Android 3.2.
Then select ApiDemos and click finish(below picture).
Note: after creation of ApiDemos sample in your eclipse workspace you should left this project open so other projects inside workspace can refer it.
Upvotes: 0
Reputation: 1007474
That resource is new to API Level 11. If you want to use that resource on earlier versions of Android, copy it out of your SDK and into your project, then reference your project-local copy. Note that you may need to make other adjustments to this layout file, as I think it will refer to some new style attributes and such that do not exist in earlier versions of Android.
Upvotes: 4