@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Respond to the action bar's Up/Home button case android.R.id.home: super.onBackPressed(); return true; } return super.onOptionsItemSelected(item); }cited from Stack Overflow
2017年5月11日 星期四
Up Navigate from Settings Activity to Main Activity
Override Original Method in Setting Activity
2017年2月26日 星期日
Android 上的 Modbus TCP/IP 測試 App
I realized almost all RW features in Bit, Byte, Word, INT, DINT, REAL, LREAL.
It is a nice app for testing modbus tcp/ip with your android smartphone.
It is a nice app for testing modbus tcp/ip with your android smartphone.
Signed APK can be found in Release folder.
PLZ give me feedback if you find bugs.
PLZ give me feedback if you find bugs.
よろしくお願いいたします。
2017年1月7日 星期六
在 Android Studio 中使用 Java 8 Lamda ---- Retrolambda Plugin
Android 目前只有 7.0 以上支援JVM8.0,因此在舊版系統中,必須使用插件來轉換
如此一來便能使用匿名表達方式Lambda來撰寫程式
如此一來便能使用匿名表達方式Lambda來撰寫程式
ref | link |
retrolambda | https://github.com/orfjackal/retrolambda |
gradle-retrolambda | https://github.com/evant/gradle-retrolambda |
2017年1月6日 星期五
Intent 啟動 Activity 方法
Intent 可以用來執行許多動作,這裡我們使用Intent來啟動另一個Activity Bundle 可以放入不同類型的物件,以便在新Activity中取用
Intent intent = new Intent(MainActivity.this,ResultActivity.class); //建立新Intent來開啟ResultActivity Bundle bundle = new Bundle(); //建立新Bundle物件 bundle.putBooleanArray("spaced", spaced); //放入物件 bundle.putInt("標籤名", 目標物件); bundle.putInt("columns", columns); bundle.putInt("inputQuantity", inputQuantity); intent.putExtras(bundle); //在Intent中加入Bundle物件 startActivity(intent); //執行Intent
當你在目標Activity中,欲取出物件時
Bundle bundle = this.getIntent().getExtras(); //取得此次呼叫Intent所附帶的Bundle spaced = bundle.getBooleanArray("spaced"); //用標籤名取得對應元件 columns = bundle.getInt("columns"); inputQuantity = bundle.getInt("inputQuantity");
2016年10月25日 星期二
利用ModbusTCPIP為Android遠端控制PLC
利用Modbus4J製作App
能夠正確讀寫 ModbusTCP/IP中的Hoding Registers
進而達到手機遠端監控PLC的目的
支援以下變數
"Bit","Byte","Word","INT","DINT","REAL","LREAL"
進而達到手機遠端監控PLC的目的
支援以下變數
"Bit","Byte","Word","INT","DINT","REAL","LREAL"
TcpTest1
Git: https://github.com/s94285/TcpTest1/
Modbus4J
SourceForge: https://sourceforge.net/projects/modbus4j/
訂閱:
文章
(
Atom
)