Thursday, January 29, 2015

Make TextView scrollable without using ScrollView

2 steps, firstly, set scroll bar rotation in AndroidManifest.xml:

Then, set the scrolling method for the TextView, mostly in onCreate() function:

Parent Activity is destroyed when providing Up navigation

If providing Up navigation behavior as Android doc:, when click the Up button on the navigation bar, the parent activity is destroyed then re-created. It is different behavior as pressing back key.

To avoid destroy parent activity, one solution is setting launch mode <singleTop> for the activity in AndroidManifest.xml:

The different between Up key and Back key is, when pressing Back key, by default, the currently activity is popup from activity stack and finished, so the previously activity shows up. When pressing Up key, the currently activity is popup from stack too, but the parent activity, which is defined in AndroidManifest.xml and maybe not the previously activity, is created to show. By default the launch mode is <standard> so the existed activity task is destroyed then re-create. To set the launch mode to <singleTop>, Android will launch the existed one instead of create a new task.

Thrift fails on Windows - thrift failed error: The command line is too long.

Meet a thrift compiling failure on my project on Windows 7. Using Maven in IntelliJ so I choiced maven-thrift-pluging for thrift files. For ...