1d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar/* 2d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* Copyright (C) 2014 The Android Open Source Project 3d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* 4d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* Licensed under the Apache License, Version 2.0 (the "License"); 5d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* you may not use this file except in compliance with the License. 6d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* You may obtain a copy of the License at 7d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* 8d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* http://www.apache.org/licenses/LICENSE-2.0 9d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* 10d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* Unless required by applicable law or agreed to in writing, software 11d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* distributed under the License is distributed on an "AS IS" BASIS, 12d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* See the License for the specific language governing permissions and 14d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar* limitations under the License. 15d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar*/ 16d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar 17d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyarpackage android.content.res; 18d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar 19d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyarimport android.annotation.Nullable; 20d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyarimport android.app.Activity; 21d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyarimport android.os.Bundle; 22d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar 23d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyarimport java.lang.ref.WeakReference; 24d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar 25d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyarpublic class ResourceCacheActivity extends Activity { 26d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar static WeakReference<ResourceCacheActivity> lastCreatedInstance; 27d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar 28d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar @Override 29d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar protected void onCreate(@Nullable Bundle savedInstanceState) { 30d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar super.onCreate(savedInstanceState); 31d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar lastCreatedInstance = new WeakReference<ResourceCacheActivity>(this); 32d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar } 33d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar 34d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar public static ResourceCacheActivity getLastCreatedInstance() { 35d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar return lastCreatedInstance == null ? null : lastCreatedInstance.get(); 36d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar } 37d422dc358f0100106dc07d7b903201eb9b043b11Yigit Boyar} 38