0

i have a problem of compilation. When i want to run my app, she don't compil. Error in method PageAdapter, in the line: super(fm)

public class PageAdapter extends FragmentPagerAdapter {

    private int[] colors;

    public PageAdapter(FragmentManager fm, int[] colors) {
        super(fm);
        this.colors = colors;
    }


    @Override
    public int getCount() {
        return(3);
    }

    @Override
    public Fragment getItem(int position) {
        return(PageFragment.newInstance(position, this.colors[position]));
    }

When i run my app, she say me:

uses or overrides a deprecated API.

C:\Users\NyCko\AndroidStudioProjects\MyNews\app\src\main\java\com\fossourier\nicolas\mynews\Adapters\PageAdapter.java: uses or overrides a deprecated API. Recompile with -Xlint:deprecation for details.

Thanks for your help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Possible duplicate: https://stackoverflow.com/questions/18311964/warning-message-uses-or-overrides-a-deprecated-api-encountered-during-code-com – Jose-Rdz Aug 02 '19 at 20:52
  • That's only a warning, not an error message. Your app should still compile (unless there's some other error). But you should fix this warning anyway - why don't you recompile with -Xlint just as the warning tells you to do? – DodgyCodeException Aug 19 '19 at 13:24
  • From (https://developer.android.com/reference/android/support/v13/app/FragmentPagerAdapter): This class was deprecated in API level 27.1.0. Use FragmentPagerAdapter instead. – Abra Aug 19 '19 at 17:14

0 Answers0