Thursday, January 29, 2015

Make TextView scrollable without using ScrollView

2 steps, firstly, set scroll bar rotation in AndroidManifest.xml:
         android:scrollbars="vertical"

Then, set the scrolling method for the TextView, mostly in onCreate() function:
        ((TextView)findViewById(R.id.textview)).setMovementMethod(ScrollingMovementMethod.getInstance());

Parent Activity is destroyed when providing Up navigation

If providing Up navigation behavior as Android doc: http://developer.android.com/training/implementing-navigation/ancestral.html, 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:
android:launchMode="singleTop"

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.

Enable HP Zbook Thunderbolt 3 Dock on Ubuntu

As mention in previously post, I installed Ubuntu on my HP ZBook. After two days used all things work just fine, but the Thunderbolt 3 Dock ...