Hi all.
I have this code in java:
Now if you call this method:
this variable "ret" i see in
and this notifyMessage go in "public void handleMessage(Message msg)" and here i have:
this value returns the size of the file found, as well as other calls that I return data type value of readings, etc.
How do i translate this code into B4A ?
Thank you
Marco
I have this code in java:
B4X:
......
case 5:
name = String.format("%d%02d%02d%02d%02d%02d.txt", c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DAY_OF_MONTH), c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND));
f = new File(folder, name);
ret = irh.doGetFile(f);
break;
}
notifyMessage(ret);
}
private void notifyMessage(int ret) {
Message msg = handler.obtainMessage();
Bundle b = new Bundle();
b.putInt("EndThread", ret);
msg.setData(b);
handler.sendMessage(msg);
}
}
private class MyHandler extends Handler {
@Override
public void handleMessage(Message msg) {
Bundle bundle = msg.getData();
if(bundle.containsKey(IrHandler.MSG_VERSION_STRING)) {
String value = bundle.getString(IrHandler.MSG_VERSION_STRING);
}
if(bundle.containsKey(IrHandler.MSG_SN_STRING)) {
String value = bundle.getString(IrHandler.MSG_SN_STRING);
}
if(bundle.containsKey(IrHandler.MSG_BATTERY_INT)) {
int value = bundle.getInt(IrHandler.MSG_BATTERY_INT);
}
if(bundle.containsKey(IrHandler.MSG_NFILE_INT)) {
int value = bundle.getInt(IrHandler.MSG_NFILE_INT);
}
if(bundle.containsKey(IrHandler.MSG_MEMUSED_INT)) {
memUsed = bundle.getInt(IrHandler.MSG_MEMUSED_INT);
}
if(bundle.containsKey(IrHandler.MSG_MEMTOT_INT)) {
memTot = bundle.getInt(IrHandler.MSG_MEMTOT_INT);
}
if(bundle.containsKey(IrHandler.MSG_AUDIT_INT)) {
int value = bundle.getInt(IrHandler.MSG_AUDIT_INT);
}
if(bundle.containsKey(IrHandler.MSG_FILE_SIZE_INT)) {
fSize = bundle.getInt(IrHandler.MSG_FILE_SIZE_INT);
}
if(bundle.containsKey(IrHandler.MSG_FILE_READ_INT)) {
int value = bundle.getInt(IrHandler.MSG_FILE_READ_INT);
}
if (bundle.containsKey("EndThread")) {
int value = bundle.getInt("EndThread");
TextView tv;
tv = (TextView) findViewById(R.id.textStatus);
...............
Now if you call this method:
B4X:
ret = irh.doGetFile(f);
this variable "ret" i see in
notifyMessage(ret);
and this notifyMessage go in "public void handleMessage(Message msg)" and here i have:
B4X:
....
if(bundle.containsKey(IrHandler.MSG_FILE_SIZE_INT)) {
fSize = bundle.getInt(IrHandler.MSG_FILE_SIZE_INT);
}
.....
this value returns the size of the file found, as well as other calls that I return data type value of readings, etc.
How do i translate this code into B4A ?
Thank you
Marco