@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fresco.initialize(this); setContentView(R.layout.activity_info); ButterKnife.bind(this); Pets.savePets(this); petsListFragment = new PetsListFragment(); Query.many(Info.class, "select * from Info").getAsync(getLoaderManager(), onInfoLoaded); if (ACTION_INFO.equals(getIntent().getAction())) { getSupportFragmentManager() .beginTransaction() .replace( R.id.container, InfoFragment.newInstance(getIntent().getStringExtra(EXTRA_PET_ID), "")) .commit(); } else { searchText.setVisibility(View.VISIBLE); } DatabaseHelper dbHelper = new DatabaseHelper(this); dbHelper.getWritableDatabase(); }
@Override public boolean onQueryTextSubmit(String query) { Query.many(Info.class, "SELECT * FROM Info WHERE name=? COLLATE NOCASE", query) .getAsync(getLoaderManager(), onSearchResult); // getSupportFragmentManager().beginTransaction() //// .replace(R.id.container, // InfoFragment.newInstance(getIntent().getStringExtra(EXTRA_PET_ID), "")) // .add(R.id.container, InfoFragment.newInstance("1", "")) // .commit(); return false; }
@Override public boolean onQueryTextChange(String newText) { Query.many(Info.class, "SELECT * FROM Info WHERE name=? COLLATE NOCASE", newText) .getAsync(getLoaderManager(), onSearchResult); return false; }