A great application should provide a function to let users set it as the preferred or default application. In this post, I will make a description on PreferredApplication
Before an application is about to be set as default, it has two possibilities. One is that there is already a default application and the other is no default application.
Package Stopped State Since Android 3.1
##First Bite Since Android 3.1, Android has introduced a LaunchControl mechanism. It’s call Stopped State.
日语文法:ください
##Nをください
- 意思:请…
- 例句:
- りんごをください 请把苹果给我
- ほんを私にください 请把书给我一下。
Fix Missing Command Takes Too Long to Respond in Fedora
I am getting well on with Fedora now. However when I was a fresher to Fedora, I have met a lot of problems.
One of them is that When I type some wrong commands It will take too long to respond. It’s totally different from Ubuntu,which I used before. However I like it could quickly reponse even through the command does not exist.
1
|
|
Ok.Add the above code to .bashrc And it works.
##Others
BashBites:Check Files
###Check a file exists
1 2 3 4 5 6 7 |
|
BashBites:Loop Through in a Directory
The trick is really easy. Just to keep record.Here we take the /tmp folder as the desired one.
1 2 3 4 5 6 |
|
##Others
日语文法例句1
连接宽带错误769:无法连接到指定目标
适宜的环境
适宜的环境,这里介绍适宜的温度和湿度,数据来自TANITA湿度计的附带资料 ##夏季
- 温度:21-25 摄氏度
- 湿度:55-65% ##冬季
- 温度:16-20 摄氏度
- 湿度:45-55%
##Others
Start InstalledAppDetails Activity With a Specific Package Name
This trick works. It’s really easy.
1 2 3 |
|
Refer String Resources From Other Applications
The following code works. Here take getting String resource for example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
###Others
Get Android System Available Features
An easy way to get system available features.
1 2 3 4 5 6 7 |
|
Have a glance at the result
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
##The Other way
You can also use adb shell
to get into the shell of your device and the use pm list features
to get the available features of a device.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
For a detailed understanding of use-filter,please read this post http://developer.android.com/guide/topics/manifest/uses-feature-element.html
###Others
Get an Application Required Features
How to get application’s required features? Actually the aapt really does a great help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
To understand the feature more detailed, please visit http://developer.android.com/guide/topics/manifest/uses-feature-element.html
###Others
Jar Mismatch! Fix Your Dependencies
There was a requirement of my work. It requires me to integrated my current project with Facebook SDK for measuring. However this came into my sights.
1
|
|
The fact is that Both my project and my library project which the former refers to have used android-support-v4.jar. However I realize the two android-support-v4.jar are different after making the md5 hash.
My solution:
I use the android-support-v4.jar in my project as the right one. And then replace the one in Facebook SDK with my project one. And then it works.
But my question remains; why it asks me for fix the dependencies to use the same lib jar file?
I guess android will keep only one file for all the references so this will ask developers to make all the same lib all the same.
Sorry for the codeless post.
###Others
Enter Recovery Mode by ADB
Remove Android Account Without Factory Reset
This will work if you want to remove account without factory reset your device. #Steps
- Make sure you have rooted your device.
- Mount /data/system as read and write access
- Go into /data/system and remove accounts.db
- Reboot your device and you made it.
###Others
How to Create Facebook Key Hash
When I create a new application on Facebook, I meet the problem. Facebook asks me to provide the Key Hash. But it does not show the guidance about how to generate. After Googling, I have found this works for me.
Before executing the following command, you need install openssl
1
|
|
Replace your-alias-value and your-keystore-path with the real data.
###Others
Dump Table Structure in SQLite3
Best answer to the question
Use PRAGMA table_info
This pragma returns one row for each column in the named table. Columns in the result set include the column name, data type, whether or not the column can be NULL, and the default value for the column. The “pk” column in the result set is zero for columns that are not part of the primary key, and is the index of the column in the primary key for columns that are part of the primary key.
Reference:http://www.sqlite.org/pragma.html#pragma_table_info
1 2 3 4 5 6 7 8 |
|
Another answer may also work
.schema [tablename] will show the CREATE statement(s) for a table or tables
1 2 |
|
###Others
Check if a Python Module Is Installed
I was once stucked in How to check Whether a Python module has been installed or not. After Googling, I found this trick.
Python allows user to pass command from out of a python file.See here
1
|
|
The result if we import an installed module
1 2 3 4 |
|
Now if we import an module which is not installed.
1 2 3 4 5 6 7 |
|
###Others
Java Get Full Exception StackTrace
As a coder, I am always handling exceptions or errors,or in a word throwables. To impove the release build, I need to collect every throwable information.
And I need to get the information as string and post it to the Bug Collect Server. Now here is an easy trick to get stacktrace from a Throwable
1 2 3 4 5 6 7 |
|
###Others
乘手扶梯的正确方法
####起因
之前一直和女朋友有一个讨论,就是搭乘扶梯时究竟时靠左站立,还是靠右站立。起因时从地铁北宫门出来的时候,我要求她站在左侧。
####我的观点
- 右侧留出来行走,更符合国内靠右行驶的习惯
- 之前看到过日本的介绍,日本是靠左侧的。
####她的观点
- 现在很多人都是靠右站立
- 她见过写着靠右站立的提示
####事实
- 左行右立(香港普遍称为左行右企)是指在歐美、香港、台灣、西日本等地於乘坐電扶梯时电梯左边空出留给有急事的乘客行走,只是站立在电梯上的人靠右侧站立的行为。與之相反的是,東日本、澳洲、新加坡等地卻採用右行左立的方式。
- 此方式為一約定俗成之法則。香港地鐵(今港鐵)及台北捷運於從前曾參考歐美等地的習慣,宣傳「左行右立」,疏通繁忙時段的人流,但不奏效。在香港停止宣傳後,「左行右立」卻反而流行起來。
- 但在電扶梯上步行會導致容易失去平衡,釀成意外,亦容易導致重力分布不均,增加電扶梯容易損壞的機率。[2]香港政府提醒市民盡量不要在電梯上走動[3],而台北捷運公司目前也基於上述之理由,不再宣傳此措施,然而大部分乘客均已養成左行右立的搭乘習慣;相較之下,台灣的另一座大眾運輸系統——高雄捷運即未若台北一般廣泛宣傳左行右立的習慣。
- 2011年北京地铁动物园站出现电动扶梯事故后,京华时报指出左行右立是不安全的行为,可能是造成电动扶梯事故的诱因之一。
- 左行右立是上海市迎接中国2010年上海世界博览会宣传倡导的城市文明行为之一。為宣傳“左行右立”标准,上海轨道交通扶手电梯处常见「左行右立」的標語,並指即使乘客站立不穩向後倒下,後面的乘客也可以支撐,不會出現骨牌效應,有利安全。[5]但自2012年12月开始,因为扶梯台阶过大,行走不安全,上海轨道交通不再强调左行右立,一些原先粘贴在扶梯上倡导左行右立的贴纸已被移除 以上事实部分参考维基百科 http://zh.wikipedia.org/wiki/%E5%B7%A6%E8%A1%8C%E5%8F%B3%E7%AB%8B 或者 Google 搜索 左行右立
####总结
- 就按我输了作为结果吧,哈哈。
- 靠左靠右并无硬性规定,社会活动中多礼让,不妨碍他人
###Others
Read Output From Shell
Python provides a lot of method to read output from a just executed shell. However many of them has been deprecated(Not recommened). But subprocess works at present compared to other methods.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
A detailed description about subprocess has been written down here. http://docs.python.org/2/library/subprocess.html
###Others
How to Determine Whether a System Is 64-bit or 32-bit
A trick in Bash
1 2 3 4 5 6 7 8 |
|
###Others
Failed Dependencies: libpopt.so.0
Trick
1
|
|
Replace One Character in Vim
Just write down this litte trick for further use. The problem how to replace one character in vim does be really simple for me now.
- First go into the Command Mode where you can issue many vi(m) commands.
- Move the cursor to the positon where your wanted character lies.
- Then press Key r (in lowser case) and enter your desired character to replace the wanted one.
###Others