Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
PagerAdapter 内で使用する必要がありますPackageManager pm = context.getPackageManager();が、コンテキストを取得する方法がわかりません。
PackageManager pm = context.getPackageManager();
public class MyPagerAdapter extends PagerAdapter { ... }
PagerAdapter内でどのようにコンテキストを設定できますか?
@DeeVの答えは、コンストラクターまたはセッターのいずれかを介して、自分でPageAdapterにコンテキストを提供する必要があることを意味します。次に、それをフィールドとしてPageAdapter内に保存し、必要なときにいつでも取得します。