Sunday, April 21, 2019

Going back to an old Gradle version in Android Studio

Android Studio 3.4 comes with a major Gradle update (from Gradle 4.x to Gradle 5.1.1). When opening old projects, it recommends applying the Gradle update to them, but not all projects are ready for it. The File | Project Structure dialog can be used to change a project back by setting the Android Gradle Plugin Version to 3.3.2 and the Gradle version to 4.10.1. After sync, Android Studio will prompt to update once more, but it can be told to not ask again for the project.

Sunday, April 14, 2019

RichTextBox should be empty before setting tabs

I've been trying to get the Windows Forms RichTextBox control to use specified tab stops for alignment purposes. Sometimes my application needs to update these while there's text in the box. As the name suggests, SelectionTabs affects the tab stops in the current selection, so all text would need to be selected first before changing it. Even that's given me trouble, though. My current strategy is to clear the text box using ResetText, setting SelectionTabs, putting the text back, and restoring the SelectionStart.