14. Utilisation du Yocto-MaxiDisplay avec Android
updateDisplay(null);
}
@Override
public
void
onNothingSelected(AdapterView<?> arg0)
{
}
public
void
updateDisplay(View
{
if
(display
return;
EditText message
// clean up
try {
display.resetAll();
// retreive the display size
int
w
int
h
// reteive the first layer
YDisplayLayer
// display a text in the middle of the screen
l0.drawText(w
).toString());
// visualize each corner
l0.moveTo(0,
l0.lineTo(0,
l0.lineTo(5,
l0.moveTo(0, h
l0.lineTo(0, h
l0.lineTo(5, h
l0.moveTo(w
l0.lineTo(w
l0.lineTo(w
l0.moveTo(w
l0.lineTo(w
l0.lineTo(w
} catch
(YAPI_Exception
e.printStackTrace();
}
}
}
14.6. Contrôle de la partie module
Chaque module peut-être contrôlé d'une manière similaire, vous trouverez ci-dessous un simple
programme d'exemple affichant les principaux paramètres d'un module et permettant d'activer la
balise de localisation.
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;
98
view)
== null)
= (EditText) findViewById(R.id.editText1);
= display.get_displayWidth();
= display.get_displayHeight();
l0
= display.get_displayLayer(0);
/
2, h
/
2, YDisplayLayer.ALIGN.CENTER,
5);
0);
0);
- 6);
- 1);
- 1);
-
1, h
- 6);
-
1, h
- 1);
-
6, h
- 1);
-
1,
5);
-
1,
0);
-
6,
0);
e) {
message.getText(
www.yoctopuce.com