I am doing a INSERT INTO query which takes to long parameters, but I am getting a 'Cannot access database on the main thread since it may potentially lock the UI for a long period of time.' error and believe I need to run this as an Async task, but am having trouble finding a pattern to follow. I was looking to the Insert query, but need to push in two long values to be used by the query, where this one passes in a note array, or something like that:

```
private static class InsertNoteRunAsyncTask extends AsyncTask<Note, Void, Void> {
    private NoteDao noteDao;

    private InsertNoteRunAsyncTask (NoteDao noteDao) {
        this.noteDao = noteDao;
    }

    @Override
    protected Void doInBackground(Note... notes) {
        noteDao.insert(notes[0]);
        return null;
    }
}

```

How do I fire off a @Query with two parameters asynchronously?

**Update**
I do not have .allowMainThreadQueries() when building the database:

```
public static synchronized AppDatabase getInstance(Context context) {

    if (instance == null)
    {
        instance = Room.databaseBuilder(context.getApplicationContext(),
                AppDatabase.class, "user-database")
                .fallbackToDestructiveMigration()
                .addCallback(roomCallback)
                .build();
    }

    return instance;
}

```