launchIntent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
-----------------------------------------------------------------------------------
multitask
2013年7月29日 星期一
2013年7月28日 星期日
建立shortcut (註冊shortcut)
Shortcuts had existed since API level 1, and can be used by 3rd party apps as well.
To add an activity to the shortcuts manu simply add this intent filter to your activity in your manifest:
To make the activity plant a new icon with an intent on the home screen, do this before finishing:
Change the
new Intent() to whatever you want launched when this is clicked. |
As the error message suggests, you could add
android:exported="true"
to your activity.
Although this should be the default value if I read the android documentation right:
android:exportedWhether or not the activity can be launched by components of other applications — "true" if it can be, and "false" if not. If "false", the activity can be launched only by components of the same application or applications with the same user ID. The default value depends on whether the activity contains intent filters. The absence of any filters means that the activity can be invoked only by specifying its exact class name. This implies that the activity is intended only for application-internal use (since others would not know the class name). So in this case, the default value is "false". On the other hand, the presence of at least one filter implies that the activity is intended for external use, so the default value is "true".
Maybe someone else can clarify this.
2013年7月20日 星期六
中文化
// ----------------------------------中文化
String localee = Locale.getDefault().getDisplayLanguage();
if (localee.equals("中文")) {
cb1.setText("1. 開啟Wifi ");
cb2.setText("2. 關閉Wifi ");
Locale locale = getBaseContext().getResources().getConfiguration().locale;
String country = locale.getCountry(); //獲得國家碼
if(country.equals("CN")){
cb1.setText("1. 开启Wifi ");
cb2.setText("2. 关闭Wifi ");
}
}
// ----------------------------------中文化end
String localee = Locale.getDefault().getDisplayLanguage();
if (localee.equals("中文")) {
cb1.setText("1. 開啟Wifi ");
cb2.setText("2. 關閉Wifi ");
Locale locale = getBaseContext().getResources().getConfiguration().locale;
String country = locale.getCountry(); //獲得國家碼
if(country.equals("CN")){
cb1.setText("1. 开启Wifi ");
cb2.setText("2. 关闭Wifi ");
}
}
// ----------------------------------中文化end
訂閱:
文章 (Atom)