Bill Farmer

Random thoughts on random subjects

Android Navigation Menu

by Bill Farmer. Categories: Hacking .

Android versions from android 5 use a Toolbar as the ActionBar, but there appears to be no obvious API access. However, by traversing the view hierarchy, it can be found and used to set up app navigation. Create a recursive function to traverse the views and find the toolbar. // findToolbar private Toolbar findToolbar(ViewGroup group) { View result = null; final int count = group.getChildCount(); for (int i = 0; i < count; i++) { View view = group.

Read more →

Update App Widget

by Bill Farmer. Categories: Hacking .

Android app widgets normally can be set up to update periodically, but not repeatedly for a short period. For a bus times app I need the widget to update every 30 seconds for about 5 minutes. I already had a Service set up to update the widget from a suitable web site and using a Handler to reset the progress bar if the background update process failed. public static final int RESET_DELAY = 5 * 1000; public static final int REPEAT_DELAY = 30 * 1000; public static final int STOP_DELAY = 5 * 60 * 1000; private Handler handler; private boolean stopUpdate; // onCreate @Override public void onCreate() { // Get handler handler = new Handler(Looper.

Read more →

Create a Word Grid

by Bill Farmer. Categories: Hacking .

A popular online puzzle game involves solving a five character word grid in the least number of moves. There are probably several ways of algorithmically generating word grids, Donald Knuth’s Dancing Links paper mentions generating a word grid. I decided to use brute force and a randomised word list. This uses a large number of lists and iterators and can generate a large number of word grids. This algorithm is used in my Gridle android app.

Read more →

Read Paywalled Newspaper Articles

by Bill Farmer. Categories: Hacking .

Most mainstream newspapers show a teaser front page on their web site, but hide most of their content behind a paywall. As with most things you can think of, there is a browser extension for this – Bypass Paywalls. However this does not work for all newspapers, the extension appears to have dropped support for The Times, for example. It is still possible to read some articles by making use of a search engine to find another source for the text of the item.

Read more →

Android Flutter

by Bill Farmer. Categories: Hacking .

Google have made a big thing of their flutter development platform, so I thought I ought to give it a try. It’s easy to install, just download the sdk, unzip it in a suitable place and add the bin folder to your path. I had to tell it where I had installed Android Studio. $ flutter config --android-studio-dir 'D:\adt\Android Studio' Setting "android-studio-dir" value to "D:\adt\Android Studio". You may need to restart any open editors for them to read new settings.

Read more →
Previous page Next page