Category Archives: Android

Remove watch face

Found that using Settings on phone to remove a watch face app did not remove the watch face from the Android Wear app or from the wearable. This method worked. Connect phone and wearable to Android Studio as if you … Continue reading

Posted in Android | Leave a comment

Toolbar overlapping listView

I had a layout with an AppBarLayout and toolbar that overlapped the first item on the ListView below it.  It appears to have been fixed by adding this line app:layout_behavior=”@string/appbar_scrolling_view_behavior” But the problem was where to add it. The answer … Continue reading

Posted in Android | 1 Comment

Simple date-time using xml

A simple way to display date-time using xml. <android.widget.TextClock android:id=”@+id/time” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:timeZone=”GMT+0000″ <!–Greenwich –> android:format24Hour=”k:mm” android:format12Hour=”@null” android:textAppearance=”?android:attr/textAppearanceMedium” android:layout_centerVertical=”true” android:layout_centerHorizontal=”true” /> Omit the timeZone to pick up local settings from phone.

Posted in Android | Leave a comment

How to vibrate wearable

Thanks to stackoverflow. Add this to manifest. <uses-permission android:name=”android.permission.VIBRATE”/> Then in code Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); long[] vibrationPattern = {0, 500, 50, 300}; //-1 – don’t repeat final int indexInPatternToRepeat = -1; vibrator.vibrate(vibrationPattern, indexInPatternToRepeat); If you don’t need a … Continue reading

Posted in Android, Wearable | Leave a comment

Colour wheel colour picker

Added a colour wheel-style colour picker in the following way. Documentation here and code here. Copyright 2012 Lars Werkman Created new activity and layout, into Build, Edit libraries and dependencies and added com.larswerkman.holocolorpicker as a library dependency. In the layout … Continue reading

Posted in Android | Leave a comment

Prepare to publish wearable

The steps for me for Wear 1.x (for which wear module must be inside handheld module) were the following. Ensure both handheld and wearable modules had same permissions and package names in their manifest files. Ensure both modules had the … Continue reading

Posted in Android | Leave a comment

Using Eclipse release key in Android Studio

I found that this stackoverflow post had some correct and some slightly misleading comments. The following worked for me. In Android Studio select Build, Generate signed APK and navigate to the release key previously used in Eclipse. Enter your keystore … Continue reading

Posted in Android | Leave a comment

Create assets folder

To create assets folder in Android Studio, right click on module and select New, Folder, Assets folder.

Posted in Android | Leave a comment

How to use Log.isLoggable

Copied in some code that had code such as: if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, “onConnected: ” + connectionHint); } and I couldn’t find any logs in logcat. If I remove the if statement then log commands appear. Solution was to … Continue reading

Posted in Android | Leave a comment

Difficult to properly install intelhaxm

To run virtual device for emulation of wearable app need to install Intel x86 emulator Accelerator. I read that the recommended method is to use the SDK. Ran the SDK manager from Android Studio, found the option under SDK Tools … Continue reading

Posted in Android | Leave a comment