@Override
protected void onPause() {
    super.onPause();
    unregisterReceiver(yourReceiver);
}2015年1月27日 星期二
Android Activity has leaked IntentReceiver that was originally registered here. Are you missing a call to unregisterReceiver()?
參考網址:http://stackoverflow.com/questions/14357566/activity-has-leaked-intentreceiver-that-was-originally-registered-here-are-you
2015年1月22日 星期四
Android不讓弹出鍵盤擋住View
在AndroidManifest.xml 加adjustPan
<activity
....
....
.
android:windowSoftInputMode="adjustPan"
</activity>
<activity
....
....
.
android:windowSoftInputMode="adjustPan"
</activity>
2015年1月21日 星期三
OpenLDAP for windows(連接mysql)
openldap 版本:openldap-2.4.38-x86
下載網址http://sourceforge.net/projects/openldapwindows/
安裝步驟 一直下一步就好(安裝路徑我是設在C:\OpenLDAP)
安裝完後打開 C:\OpenLDAP\etc\openldap\slapd.conf
找到BDB database definitions部分
可以修改下面3行(我是用默認的,做測試用的而已)         
suffix "dc=my-domain,dc=com"
rootdn "cn=Manager,dc=my-domain,dc=com"
rootpw test
過來就是連接mysql部分
找到# MySQL Database  修改資料庫資料
backend              sql
database             sql
suffix               "dc=example,dc=com"
rootdn               "cn=root,dc=example,dc=com"
rootpw               test
dbname               openldap    #資料庫表名稱
dbuser               root         #資料庫帳號
dbpasswd           ******     #資料庫密碼
insentry_stmt       "INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval) VALUES (?,?,?,?)"
subtree_cond         "ldap_entries.dn LIKE CONCAT('%',?)"
upper_func           "upper"
concat_pattern       "?+?"
has_ldapinfo_dn_ru   no
check_schema         yes
database        monitor
修改完到C:\OpenLDAP\etc 打開odbc.ini
找到MySQLTestServer 改成
[openldap]  #資料庫表名稱
Driver=MySQL
Description=Test MySQL Database 2013
Server=localhost
Port=3306
Database=openldap #資料庫表名稱
# UID=openldap
Password=*****  #資料庫密碼
改完後到C:\OpenLDAP\etc\back-sql\mysql  
把01_backsql_create.sql,
   02_testdb_create.sql
   03_testdb_data.sql
   04_testdb_metadata.sql
都匯到資料庫
設定完後到C:\OpenLDAP\libexec  按StartLDAP.cmd  啟動
啟動完就可以連了
2015年1月14日 星期三
Android update ViewPager View
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = null;
view = mInflater.inflate(R.layout.record_list_layout, null);
TextView test= (TextView) view.findViewById(R.id.test);
String key = "test" + position;
test.setTag(key);
((ViewPager) arg0).addView(view );
return view;
}
//0為第一筆
TextView test= myViewPager.findViewWithTag("test0");
// 更新內容
if (test!= null ) {
test.setText("update");
}
2015年1月12日 星期一
JAVA 亂數排序 Collections.shuffle
|         ArrayList<String> list=newArrayList<String>(); | 
|         list.add("a"); | 
|         list.add("b"); | 
|         list.add("c"); | 
|         list.add("d"); | 
|         Collections.shuffle(list); | 
|          | 
|         for(String result:list) | 
|         { | 
|          System.out.println(result); | 
|         } | 
2015年1月5日 星期一
android viewpager setting destroy
in revision 4 of the Support Package, a method was added to ViewPager which allows you to specify the number of offscreen pages to use, rather than the default which is 1.
In your case, you want to specify 2, so that when you are on the third page, the first one is not destroyed, and vice-versa.
mViewPager = (ViewPager)findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(2);
訂閱:
意見 (Atom)
