diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/mobile-android/calculator-android/src/calculator/android |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/mobile-android/calculator-android/src/calculator/android')
-rw-r--r-- | sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java b/sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java new file mode 100644 index 0000000000..7d6a6613ed --- /dev/null +++ b/sandbox/mobile-android/calculator-android/src/calculator/android/CalculatorClient.java @@ -0,0 +1,36 @@ +package calculator.android; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import calculator.CalculatorService; +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +public class CalculatorClient extends Activity { + + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + StringBuffer sb = new StringBuffer(); + + SCADomain scaDomain = SCADomain.newInstance(this, "dex://calculator.android/raw/calculator.composite"); + + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + + // Calculate + sb.append("3 + 2=" + calculatorService.add(3, 2)); + sb.append("3 - 2=" + calculatorService.subtract(3, 2)); + sb.append("3 * 2=" + calculatorService.multiply(3, 2)); + sb.append("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + + TextView tv = new TextView(this); + tv.setText(sb.toString()); + setContentView(tv); + + } +}
\ No newline at end of file |