- Edit AwesomeProject\Android\gradle.properties, add proxy config:
- systemProp.http.proxyHost=10.255.247.227
- systemProp.http.proxyPort=8080
- systemProp.https.proxyHost=10.255.247.227 systemProp.https.proxyPort=8080
Wednesday, March 8, 2017
How to build React-Native behind proxy
Recently I tried to setup and build react-native app (mostly for Android), behind a proxy server. To pass the gradle build, need set proxy config as below:
Thursday, May 5, 2016
error: undefined reference to '__android_log_print' in Android Studio 2.1
Need load the android log lib in app/build.gradle:
android.ndk {
moduleName = "[the_module_name]"
ldLibs.addAll(['android', 'log'])
}
android.ndk {
moduleName = "[the_module_name]"
ldLibs.addAll(['android', 'log'])
}
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());
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:
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.
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.
Tuesday, October 28, 2014
Get Android Kernel log
To catch Kernel log, need a rooted Android device and adb shell worable, then use the adb logcat command:
$adb shell logcat -v time -f /dev/kmsg | cat /proc/kmsg
To write the output to a file:
$adb shell logcat -v time -f /dev/kmsg | cat /proc/kmsg > /sdcard/log.txt
Thursday, April 24, 2014
Get navigation bar (TSB bar) height
The dim value is defined as com.android.internal.R.dimen.navigation_bar_height.
final int naviHeight = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_height);
final int naviHeight = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_height);
Monday, April 14, 2014
How to exclude activity from recent application list on Android
To forbidden your activity in the recent application list, just define this parameter in AndroidManifest.xml for the activity:
for example:
<activity
android:name="com.test.MainActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:excludeFromRecents="true"
android:label="@string/app_name">
......
</activity>
android:excludeFromRecents="true"
for example:
<activity
android:name="com.test.MainActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:excludeFromRecents="true"
android:label="@string/app_name">
......
</activity>
Subscribe to:
Posts (Atom)
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 ...
-
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 ...
-
I tried to add a VideoView to a layout dynamic via code in my Android app, but the whole screen flashes when the VideoView was added first ...
-
To create a button in Android app like this: The layout XML: <Button android:layout_width="match_parent" andro...