Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAshish Cherian
1,709 Pointsset list adapter not working !!
(```) package com.example.jacosynthesis14;
import android.os.Bundle; import android.app.Activity; import android.app.LauncherActivity; import android.view.Menu; import android.widget.ArrayAdapter;
public class MainListActivity extends Activity {
protected String[] mAndroidNames={
"one",
"Two",
"three",
"four",
"five",
"six",
"seven"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_list);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mAndroidNames);
setListAdapter(adapter); }
(```)
this is the code
It gives an error on setListAdapter(adapter);
asks me to create method setListAdapter
oh and i am also getting these errors
Description Resource Path Location Type ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 85 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 98 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 102 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 103 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 43 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 49 Java Problem FragmentPagerAdapter cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 81 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 82 Java Problem The method onPageScrolled(int, float, int) of type FragmentNestingPagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 128 Java Problem The method onPageSelected(int) of type FragmentNestingPagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 132 Java Problem The method onPageScrollStateChanged(int) of type FragmentNestingPagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 137 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 145 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 104 Java Problem The method setListAdapter(ArrayAdapter<String>) is undefined for the type MainListActivity MainListActivity.java /JacoSynthesis/src/com/example/jacosynthesis14 line 25 Java Problem The method notifyDataSetChanged() is undefined for the type FragmentNestingPagerSupport.TabsAdapter FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 113 Java Problem The method getItem(int) of type FragmentStatePagerSupport.MyAdapter must override or implement a supertype method FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 84 Java Problem The method getCount() of type FragmentNestingPagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 117 Java Problem The method getItem(int) of type FragmentNestingPagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 122 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 53 Java Problem The method getCount() of type FragmentStatePagerSupport.MyAdapter must override or implement a supertype method FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 79 Java Problem FragmentStatePagerAdapter cannot be resolved to a type FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 73 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 47 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 46 Java Problem ViewPager cannot be resolved to a type FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 68 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 45 Java Problem ViewPager cannot be resolved to a type FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 62 Java Problem ViewPager cannot be resolved to a type FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 56 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 45 Java Problem ViewPager cannot be resolved to a type FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 55 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 38 Java Problem ViewPager cannot be resolved to a type FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 55 Java Problem The import android.support cannot be resolved ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 30 Java Problem ViewPager cannot be resolved to a type FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 46 Java Problem The import android.support cannot be resolved ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 29 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 41 Java Problem The method notifyDataSetChanged() is undefined for the type ActionBarTabsPager.TabsAdapter ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 115 Java Problem The import android.support cannot be resolved FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 23 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 106 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 34 Java Problem The import android.support cannot be resolved FragmentStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 22 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 105 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 42 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 104 Java Problem ViewPager cannot be resolved to a type FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 41 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 100 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 87 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 84 Java Problem The import android.support cannot be resolved FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 30 Java Problem FragmentPagerAdapter cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 83 Java Problem The import android.support cannot be resolved FragmentNestingPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 29 Java Problem The method getCount() of type ActionBarTabsPager.TabsAdapter must override or implement a supertype method ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 119 Java Problem The method getItem(int) of type ActionBarTabsPager.TabsAdapter must override or implement a supertype method ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 124 Java Problem The method onPageScrolled(int, float, int) of type ActionBarTabsPager.TabsAdapter must override or implement a supertype method ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 130 Java Problem The method onPageSelected(int) of type ActionBarTabsPager.TabsAdapter must override or implement a supertype method ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 134 Java Problem The method onPageScrollStateChanged(int) of type ActionBarTabsPager.TabsAdapter must override or implement a supertype method ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 139 Java Problem ViewPager cannot be resolved to a type ActionBarTabsPager.java /Support13Demos/src/com/example/android/supportv13/app line 147 Java Problem The method setBackgroundDrawable(Drawable) from the type View is deprecated CheckableFrameLayout.java /Support13Demos/src/com/example/android/supportv13/view line 38 Java Problem [I18N] Hardcoded string "Button", should use @string resource activity_main_list.xml /JacoSynthesis/res/layout line 28 Android Lint Problem The import android.support cannot be resolved FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 22 Java Problem ViewPager cannot be resolved to a type FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 46 Java Problem The import android.support cannot be resolved FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 23 Java Problem ViewPager cannot be resolved to a type FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 55 Java Problem ViewPager cannot be resolved to a type FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 55 Java Problem ViewPager cannot be resolved to a type FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 62 Java Problem ViewPager cannot be resolved to a type FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 56 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 41 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 36 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 34 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 36 Java Problem The import android.support cannot be resolved FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 30 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 34 Java Problem The import android.support cannot be resolved FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 29 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 33 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 33 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 28 Java Problem The import android.support cannot be resolved FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 22 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 49 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 43 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 40 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 40 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 38 Java Problem FragmentTabHost cannot be resolved to a type FragmentTabsFragment.java /Support13Demos/src/com/example/android/supportv13/app line 38 Java Problem The method onPageScrolled(int, float, int) of type FragmentNestingStatePagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 128 Java Problem The method getCount() of type FragmentPagerSupport.MyAdapter must override or implement a supertype method FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 79 Java Problem The method onPageSelected(int) of type FragmentNestingStatePagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 132 Java Problem The method getItem(int) of type FragmentPagerSupport.MyAdapter must override or implement a supertype method FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 84 Java Problem ViewPager cannot be resolved to a type FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 68 Java Problem The method getCount() of type FragmentNestingStatePagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 117 Java Problem FragmentPagerAdapter cannot be resolved to a type FragmentPagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 73 Java Problem The method getItem(int) of type FragmentNestingStatePagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 122 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 104 Java Problem The method notifyDataSetChanged() is undefined for the type FragmentNestingStatePagerSupport.TabsAdapter FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 113 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 102 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 103 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 85 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 98 Java Problem FragmentStatePagerAdapter cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 81 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 82 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 43 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 49 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 41 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 42 Java Problem ViewPager cannot be resolved to a type FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 145 Java Problem The method onPageScrollStateChanged(int) of type FragmentNestingStatePagerSupport.TabsAdapter must override or implement a supertype method FragmentNestingStatePagerSupport.java /Support13Demos/src/com/example/android/supportv13/app line 137 Java Problem
please help
1 Answer
Abdalla Ali
2,972 PointsHi Ashish,
Based on the code snippet, i think the problem is that you need to extend your class to ListActivity instead of normal Activity.
Change the following line
public class MainListActivity extends Activity
To this line
public class MainListActivity extends ListActivity
Hope this helps.