Skip to content

Instantly share code, notes, and snippets.

@janishar
Created February 13, 2017 10:47
Show Gist options
  • Save janishar/be0f4d3cdf57ee7cbd14ffdac5f52a8a to your computer and use it in GitHub Desktop.
Save janishar/be0f4d3cdf57ee7cbd14ffdac5f52a8a to your computer and use it in GitHub Desktop.
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView = (TextView) findViewById(R.id.text);
// Put this in a different thread or use AsyncSession in greenDAO.
// For Demo purpose, this query is made on main thread but it should in a different thread.
User user = ((DemoApp)getApplication()).getDaoSession().getUserDao().load(1L);
if(user != null){
textView.setText(user.getName());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment