Skip to content

Instantly share code, notes, and snippets.

View Rangor's full-sized avatar

Martin M Syvertsen Rangor

  • Sarpsborg, Norway
View GitHub Profile
@Rangor
Rangor / memoryactivity.java
Created December 7, 2016 08:37
Android memory testing
public class MemoryTesterActivity extends AppCompatActivity {
List<String> memoryHog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_memory_tester);
memoryHog = new ArrayList<>();
public void populateBusstopList() {
stopsCursor = mDbHelper.fetchAllBusstops();
bussStopList = new ArrayList<OverlayItem>();
if (stopsCursor.moveToFirst()) {
int nameColumn = stopsCursor.getColumnIndex(QueryDb.KEY_STOP_NAME);
int latColumn = stopsCursor.getColumnIndex(QueryDb.KEY_STOP_LATITUDE);
int lngColumn = stopsCursor.getColumnIndex(QueryDb.KEY_STOP_LONGITUDE);
do {
@Rangor
Rangor / gist:2863768
Created June 3, 2012 14:36
Android typical DB example
public void AddNewBankAccountToPerson(Person person) throws SQLException {
//Create new account
BankAccount bankAccount = new BankAccount();
bankAccount.accountNumber = 123456;
bankAccount.balance = 100;
ormLiteDB.bankAccountDao.create(bankAccount);
//Fetch from DB to get ID
bankAccount = ormLiteDB.bankAccountDao.queryForMatching(bankAccount).get(0);