ListActivity ormlite problem?

I have a fairly large code written when I decided to use ORMLite.

After reading the document, I found that I would need to stretch like:

MyClass extends OrmLiteBaseActivity<DatabaseHelper>

but I have already expanded its ListActivity.

Can this be done without the OrmLiteBaseActivity extension?

Tnx in advance.

+3
source share
2 answers

No extension required OrmLiteBaseActivity. You just need to manage the utility functions yourself.

- DatabaseHelper , , , . , , OrmLiteBaseActivity. , . .


:

private static Dao<Agent, Object> agentDao = null;
public void someMethod() {
    if(agentDao == null){
      helper = (MyDBHelper) OpenHelperManager.getHelper(getContext());
      try {
        agentDao = helper.getAgentDao();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
  }

DAO MyDBHelper. ORMLite Android Javadoc, ORMLite Core Javadoc. .

+7

[@ , , . ]

ORMLite OrmLiteBaseListActivity, 4.10 - . , OrmLiteBaseTabActivity, , TabActivity ListActivity. , . 4.10 , .

:

public abstract class OrmLiteBaseListActivity<H extends OrmLiteSqliteOpenHelper>
    extends ListActivity {
    // insert contents of the OrmLiteBaseTabActivity class here
}
+1

Source: https://habr.com/ru/post/1788515/


All Articles