|
package com.clouddevelop.ledtest;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
public class LEDTestActivity extends Activity {
LinearLayout m_layout;
private Button m_btnOn;
private Button m_btnOff;
CloudLed m_led;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
m_layout = new LinearLayout(this);
m_btnOn = new Button(this);
m_btnOn.setText("ON");
m_btnOn.setWidth(300);
m_btnOff = new Button(this);
m_btnOff.setText("OFF");
m_btnOff.setWidth(300);
m_led = new CloudLed();
m_btnOn.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
m_led.turnOn();
}});
m_btnOff.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
m_led.turnOff();
}});
m_layout.setHorizontalFadingEdgeEnabled(false);
m_layout.setVerticalFadingEdgeEnabled(true);
m_layout.addView(m_btnOff);
m_layout.addView(m_btnOn);
setContentView(m_layout);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
m_led.turnOff();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
CloudBox cross-platform framework. (iOS+ Android)
Github: cloudhsu
My APP:
1. Super Baby Pig (iOS+Android)
2. God Lotto (iOS+Android)
2. Ninja Darts (iOS)
3. Fight Bingo (iOS)