当前位置: 首页>>代码示例>>Java>>正文


Java AndroidPreferences类代码示例

本文整理汇总了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);
}
 
开发者ID:eyeRS,项目名称:eyeRS,代码行数:73,代码来源:LoginActivity.java

示例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));
}
 
开发者ID:SiliconLabs,项目名称:thunderboard-android,代码行数:5,代码来源:GdxDemoActivity.java


注:本文中的com.badlogic.gdx.backends.android.AndroidPreferences类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。