本文整理汇总了Java中com.badlogic.gdx.backends.android.AndroidPreferences类的典型用法代码示例。如果您正苦于以下问题:Java AndroidPreferences类的具体用法?Java AndroidPreferences怎么用?Java AndroidPreferences使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AndroidPreferences类属于com.badlogic.gdx.backends.android包,在下文中一共展示了AndroidPreferences类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.badlogic.gdx.backends.android.AndroidPreferences; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
if (EyeRS.PREFERENCES == null) {
EyeRS.PREFERENCES = new AndroidPreferences(getSharedPreferences(EyeRS.PREFS_NAME, Context.MODE_PRIVATE));
}
super.onCreate(savedInstanceState);
SettingUtilities.onActivityCreateSetTheme(this);
super.setContentView(R.layout.activity_login);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
this.txtPIN = (EditText) findViewById(R.id.txtPIN);
this.loginButton = (Button) findViewById(R.id.btnLogin);
this.loginButton.setOnClickListener(this);
findViewById(R.id.txtForgotPin).setOnClickListener(this);
this.registerButton = (Button) findViewById(R.id.btnRegister);
this.registerButton.setOnClickListener(this);
/*
* Content resolver object
*/
eyeRSContentResolver = this.getContentResolver();
String[] projection = {
UserRegistrationInfo.REG_ID,
UserRegistrationInfo.USER_NAME,
UserRegistrationInfo.EMAIL_ADD,
UserRegistrationInfo.USER_PIN,
UserRegistrationInfo.SECURITY_QUESTION,
UserRegistrationInfo.SECURITY_RESPONSE
};
String whereClause = "";
String[] whereArgs = {};
String sortOrder = "";
try {
/*
* Content Resolver query
*/
Cursor cursor = eyeRSContentResolver.query(DBOperations.CONTENT_URI_USER_REG, projection,
whereClause, whereArgs, sortOrder);
if (!cursor.moveToFirst()) {
/*
* No user registered so disable the Login button
*/
this.loginButton.setEnabled(false);
} else if (cursor.moveToFirst()) {
/*
* If a user has been registered already
* we need to disable the Register button to follow
* the Single-User per Device policy
*/
this.registerButton.setEnabled(false);
cursor.close();
}
} catch (Exception ex) {
Log.e("Login query", ex.getMessage(), ex);
}
/*Initialising mediaPlayer*/
welcomeMessage = MediaPlayer.create(LoginActivity.this, R.raw.welcomemsg);
}
示例2: getPreferences
import com.badlogic.gdx.backends.android.AndroidPreferences; //导入依赖的package包/类
@Override
public Preferences getPreferences(String name) {
return new AndroidPreferences(getContext().getSharedPreferences(name, Context.MODE_PRIVATE));
}