updateDisplay
(
null
);
}
@Override
public
void
onNothingSelected
(
AdapterView
<?>
arg0
)
{
}
public
void
updateDisplay
(
View
view
)
{
if
(
display
==
null
)
return;
EditText message
=
(
EditText
)
findViewById
(
R.
id
.
editText1
);
// clean up
try
{
display.
resetAll
();
// retreive the display size
int
w
=
display.
get_displayWidth
();
int
h
=
display.
get_displayHeight
();
// reteive the first layer
YDisplayLayer
l0
=
display.
get_displayLayer
(
0
);
// display a text in the middle of the screen
l0.
drawText
(
w
/
2
, h
/
2
,
YDisplayLayer
.
ALIGN
.
CENTER
, message.
getText
(
)
.
toString
());
// visualize each corner
l0.
moveTo
(
0
,
5
);
l0.
lineTo
(
0
,
0
);
l0.
lineTo
(
5
,
0
);
l0.
moveTo
(
0
, h
-
6
);
l0.
lineTo
(
0
, h
-
1
);
l0.
lineTo
(
5
, h
-
1
);
l0.
moveTo
(
w
-
1
, h
-
6
);
l0.
lineTo
(
w
-
1
, h
-
1
);
l0.
lineTo
(
w
-
6
, h
-
1
);
l0.
moveTo
(
w
-
1
,
5
);
l0.
lineTo
(
w
-
1
,
0
);
l0.
lineTo
(
w
-
6
,
0
);
}
catch
(
YAPI_Exception
e
)
{
e.
printStackTrace
();
}
}
}
19.6. Control of the module part
Each module can be controlled in a similar manner, you can find below a simple sample program
displaying the main parameters of the module and enabling you to activate the localization beacon.
package
com.yoctopuce.doc_examples
;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView.OnItemSelectedListener
;
import
android.widget.ArrayAdapter
;
import
android.widget.Spinner
;
import
android.widget.Switch
;
import
android.widget.TextView
;
import
com.yoctopuce.YoctoAPI.YAPI
;
import
com.yoctopuce.YoctoAPI.YAPI_Exception
;
import
com.yoctopuce.YoctoAPI.YModule
;
public
class
ModuleControl
extends
Activity
implements
OnItemSelectedListener
19. Using the Yocto-Display with Android
118
www.yoctopuce.com
Summary of Contents for Yocto-Display
Page 1: ...Yocto Display User Manual...
Page 2: ......
Page 40: ...34 www yoctopuce com...
Page 52: ...46 www yoctopuce com...
Page 84: ...78 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 130: ...124 www yoctopuce com...
Page 422: ...416 www yoctopuce com...