Android note1

1.Edittext控件:只要设置了id值,当旋转手机时,会自动保存其中的值;
2.Spinner值的获取:
  1. spinnerXXX.getSelectedItem().toString();
  2. 在onItemSelected方法中,用传进来arg2参数作为资源的index,从资源中找到对应的值
     Activity.this.getResources().getStringArray(R.array.ArrayXXX)[arg2]
  3.使用 SharedPreferences来读取和保存virtual call setting数据
  写操作:
  preferences = getSharedPreferences("mango_callset",MODE_PRIVATE);
editor = preferences.edit();
editor.putString("name", inputname.getText().toString());
editor.putString("num",  inputnum.getText().toString());
editor.putString("time", spinner.getSelectedItem().toString());
editor.commit(); //这行是执行写入操作,必须加入
读操作:
    preferences.getString("name", null);
   
3.如何设置Android SDK的source path(以Android4.3为例):
  a.打开ADT-->Package Explorer->对应工程名->Android4.3->android.jar 
  b.右键->Properties,打开左侧的Java Source Attachment
  c.选择External location,点External Folder,选择对应Android4.3 SDK源代码文件夹位置:
    如: XX:/XXX/sdk/sources/android-18

你可能感兴趣的:(android)