「あなたのアプリはPreferenceActivityクラスの安全でない実装を使用しているため、フラグメント注入の影響を受けやすい」というエラーが表示されます。 Google Playから「PreferenceActivityクラスの安全でない実装」というエラーを修正するにはどうすればよいですか?
私はそれがクラスPreferenceActivityが時代遅れであることを意味していhttps://support.google.com/faqs/answer/7188427?hl=enと
Your implementation of PreferenceActivity is vulnerable to fragment injectionを読んだことがありますか?どのように問題を解決できますか?
のAndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.dodata.unlock"
android:versionCode="8"
android:versionName="1.08" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:allowBackup="true"
android:icon="@drawable/unlockwithwifi"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="ui.UnlockMain"
android:launchMode="singleTop"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="ui.UnlockAddWiFi"
android:label="@string/app_name">
<intent-filter>
<action android:name="ui.UnlockAddWiFi" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="ui.LockPreference">
<intent-filter>
<action android:name="ui.LockPreference" />
<category android:name="android.intent.category.PREFERENCE" />
</intent-filter>
</activity>
...
</application>
</manifest>
LockPreference.java
public class LockPreference extends PreferenceActivity{
private AdView adView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.unlockpreference);
setContentView(R.layout.unlock_custom_preference);
adView=(AdView) findViewById(R.id.adView);
PublicParFun.SetAD(adView);
SetDisplayIcon();
Button btnClose=(Button)findViewById(R.id.btnClosePreference);
btnClose.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
}
});
}
...
}
unlockpreference.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="AppPreference"
android:summary="@string/PreferenceSummary"
android:title="@string/Preference" >
<ui.custom.DialogChangePassword
android:key="ChangePassword"
android:dialogIcon="@android:drawable/ic_dialog_alert"
android:title="@string/ChangePasswordTitle"
android:summary="@string/ChangePasswordSummary"
android:positiveButtonText="@string/BtnSave"
android:negativeButtonText="@string/BtnCancel"
android:layout="@layout/unlock_custom_preference_item"
/>
<CheckBoxPreference
android:defaultValue="true"
android:key="DisplayNotificationIcon"
android:title="@string/DisplayNotificationIconTitle"
android:summary="@string/DisplayNotificationIconSummary"
android:layout="@layout/unlock_custom_preference_item"
/>
</PreferenceScreen>
ありがとう!完全なサンプルコードを教えてください。 – HelloCW
https://github.com/codepath/android_guides/wiki/Settings-with-PreferenceFragmentこのwikiページを見る実装済み –
ありがとう! PreferenceActivityクラスは廃止されましたか? – HelloCW