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.
アクティビティの開始時に1つのアクティビティですべてのデータを取得し、そのデータを他のすべてのアクティビティで使用したい。すべてのユーザー情報、電話からのすべての連絡先を取得し、サーバーデータなどと比較するように。前もって感謝します。
Android で Application クラスを拡張できます。これはシングルトン クラスであるため、そこに設定した値は別のアクティビティからアクセスできます。
すべてのアクティビティで、このようにアプリケーションインスタンスにアクセスできます
MyApplication appContext = (MyApplication)getApplicationContext();
マニフェスト ファイル内で、アプリケーション タグに属性を追加します。
android:name=".MyApplication"