2013/03/30
Visual Studio 2012 で TypeScript 開発環境を構築

使ってみると、TypeScript なかなか良い感じです。
プログラム全般、無節操に手を出しまくってみる
$ sudo add-apt-repository ppa:langdalepl/gvfs-mtp $ sudo apt-get update $ sudo apt-get upgrade |
OnItemClickListener.onItemClick()
の中ではどうなのか、調べてみました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | public class MainActivity extends ListActivity { private static final String TAG = "MainActivity" ; @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); String[] listItems = { "1" , "2" , "3" }; getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); ListAdapter adapter = new ArrayAdapter<String>( this , android.R.layout.simple_list_item_multiple_choice, listItems); setListAdapter(adapter); getListView().setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { CheckedTextView cv = (CheckedTextView) view; Log.d(TAG, "isChecked " + cv.isChecked()); } }); } } |
// OFF → ON isChecked false // ON → OFF isChecked true |
// OFF → ON isChecked true // ON → OFF isChecked false |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | public class MainActivity extends ListActivity { private static final String TAG = "MainActivity" ; @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); String[] listItems = { "1" , "2" , "3" }; getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); ListAdapter adapter = new ArrayAdapter<String>( this , android.R.layout.simple_list_item_multiple_choice, listItems); setListAdapter(adapter); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // ↓ 少なくとも Android 4.2 までは空関数 // super.onListItemClick(l, v, position, id); CheckedTextView cv = (CheckedTextView) v; Log.d(TAG, "isChecked " + cv.isChecked()); } } |
// OFF → ON isChecked false // ON → OFF isChecked true |
// OFF → ON isChecked true // ON → OFF isChecked false |
1 2 3 4 | CheckedTextView cv = (CheckedTextView) v; boolean isChecked = (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) ? !cv.isChecked() : cv.isChecked(); |
onListItemClick()
の中では isChecked()
を呼ばない方が無難だという事になります。$ tar zxf cnijfilter-mp640series-3.20-1-i386-deb.tar.gz $ cd cnijfilter-mp640series-3.20-1-i386-deb $ sudo ./install.sh ================================================== Canon Inkjet Printer Driver Ver.3.20-1 for Linux Copyright CANON INC. 2001-2009 All Rights Reserved. ================================================== Error! Cannot specify package management system. |
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 | C_FUNC_get_system() { local c_system_rpm= "" local c_system_deb= "" ## Judge is the distribution supporting rpm? ## rpm --version 1> /dev/null 2>&1 c_system_rpm=$? ## Judge is the distribution supporting dpkg(debian)? ## dpkg --version 1> /dev/null 2>&1 c_system_deb=$? ## rpm and deb are error, or rpm and deb are no error, is error ## if [ $c_system_rpm = 0 -a $c_system_deb = 0 ] || [ $c_system_rpm != 0 -a $c_system_deb != 0 ]; then echo $C_err_msg1 return $C_ERR_CODE else if test $c_system_rpm - eq 0; then C_system= "rpm" else C_system= "deb" fi fi return 0 } |
$ rpm --version RPM version 4.9.1.1 $ dpkg --version Debian `dpkg' package management program version 1.16.1.2 (amd64). This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. |
$ sudo apt-get remove rpm $ sudo apt-get autoremove |
android.app.Application
を継承した独自実装の Application
を使用して、その onCreate()
にログを仕込んでいた状態だったので気づいたのです。1 2 3 4 5 6 7 8 9 10 | public class MyApplication extends Application { private static final String TAG = "MyApplication" ; @Override public void onCreate() { super .onCreate(); Log.d(TAG, "onCreate" ); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | package = "com.kokufu.android.test.sampletarget" android:versionCode = "1" android:versionName = "1.0" > < uses-sdk android:minSdkVersion = "8" android:targetSdkVersion = "17" /> < application android:name = ".MyApplication" android:allowBackup = "true" android:icon = "@drawable/ic_launcher" android:label = "@string/app_name" android:theme = "@style/AppTheme" > <!-- 省略 --> </ application > </ manifest > |
1 2 3 4 5 6 7 8 9 10 11 | public class MyTest extends TestCase { private static final String TAG = "MyTest" ; public void testA() { Log.d(TAG, "testA" ); } public void testB() { Log.d(TAG, "testB" ); } } |
onCreate
が2度呼ばれています。onCreate
だけ PID が異なります。
アプリケーション開発から組み込みまで手を出しているフリーランスのエンジニア
何故か C,C++ の仕事をすることが多いけど、本当は Java や C# が好き
最近は Android がらみ多し