Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Android Wear Projects

You're reading from   Android Wear Projects Create smart Android Apps for Wearables

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher Packt
ISBN-13 9781787123229
Length 416 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ashok Kumar S Ashok Kumar S
Author Profile Icon Ashok Kumar S
Ashok Kumar S
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting You Ready to Fly - Setting Up Your Development Environment FREE CHAPTER 2. Let us Help Capture What is on Your Mind - WearRecyclerView and More 3. Let us Help Capture What is on Your Mind - Saving Data and Customizing the UI 4. Measure Your Wellness - Sensors 5. Measuring Your Wellness and Syncing Collected Sensor Data 6. Ways to Get Around Anywhere - WearMap and the GoogleAPIclient 7. Ways to Get Around Anywhere - UI controls and More 8. Let us Chat in a Smart Way - Messaging API and More 9. Let us Chat in a Smart Way - Notifications and More 10. Just a Face for Your Time - WatchFace and Services 11. More About Wear 2.0

Saving data in SQLite


To connect SQLite to the and to save the data in SQLite, implement the activity LoaderManager.LoaderCallbacks<Cursor> and instatiate the datasource in the onCreate method:

mDataSource = new MemoriesDataSource(this);
getLoaderManager().initLoader(0,null,this);

Implement the callback methods for the LoaderManager.LoaderCallbacks<Cursor> interface:

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return null;
}

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {

}

@Override
public void onLoaderReset(Loader<Cursor> loader) {

}

Now, refactor the addingMarker code in a method as follows:

private void addMarker(Memory memory) {
    Marker marker = mMap.addMarker(new MarkerOptions()
            .draggable(true)
            .position(new LatLng(memory.latitude, memory.longitude)));

    mMemories.put(marker.getId(), memory);
}

We still need to work with dragging the marker for future implementation...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image