我正在使用 Sugar Orm,我想绑定一个微调器,代码
public class RegisterActivity extends Activity {
Spinner spnAge;
ArrayAdapter<Age> ageAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
new LoadAsync().execute("");
}
private class LoadAsync extends AsyncTask<String,Void,String>
{
@Override
protected String doInBackground(String... params) {
return "";
}
@Override
protected void onPostExecute(String s) {
spnAge = (Spinner)findViewById(R.id.spnAge);
List<Age> ages = Age.listAll(Age.class);
ageAdapter = new ArrayAdapter<Age>(getBaseContext(),android.R.layout.simple_spinner_item, ages);
ageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnAge.setAdapter(ageAdapter);
}
}
}
但代码不起作用并显示日志:
跳过了 65 帧!应用程序可能在其主线程上做了太多工作。