SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
Now Loading. Please Wait ...




                Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
<?xml version="1.0" encoding="utf-8"?>
                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
                android"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical" >

                    <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello" />

                </LinearLayout>




                                                   Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
package ykmjuku.android.sample.app;

   public class Calculater {
       StringBuilder mInputNumber = new StringBuilder();
       String mOperator;
       int mResult = 0;

            private boolean isNumber(String key) {
                try {
                    Integer.parseInt(key);
                    return true;
                } catch (NumberFormatException e) {
                }
                return false;
            }




                                                           Re:Kayo-System Co.,Ltd.

2012   2   22
private boolean isSupportedOperator(String key) {
                if (key.equals("+")) {
                    return true;
                } else if (key.equals("-")) {
                    return true;
                } else if (key.equals("*")) {
                    return true;
                } else if (key.equals("/")) {
                    return true;
                }
                return false;
            }




                                                               Re:Kayo-System Co.,Ltd.

2012   2   22
private void doCalculation(String ope) {
                if (ope.equals("+")) {
                    mResult = mResult + Integer.parseInt(mInputNumber.toString());
                } else if (ope.equals("-")) {
                    mResult = mResult - Integer.parseInt(mInputNumber.toString());
                } else if (ope.equals("*")) {
                    mResult = mResult * Integer.parseInt(mInputNumber.toString());
                } else if (ope.equals("/")) {
                    mResult = mResult / Integer.parseInt(mInputNumber.toString());
                }
                mInputNumber = new StringBuilder();
            }




                                                                          Re:Kayo-System Co.,Ltd.

2012   2   22
public String putInput(String key) {
               if (isNumber(key)) {
                   mInputNumber.append(key);
                   return mInputNumber.toString();
               } else if (isSupportedOperator(key)) {
                   if (mOperator != null) {
                        doCalculation(mOperator);
                        mOperator = null;
                   } else if (mInputNumber.length() > 0) {
                        mResult = Integer.parseInt(mInputNumber.toString());
                        mInputNumber = new StringBuilder();
                   }
                   mOperator = key;
                   return mOperator;
               } else if (key.equals("=")) {
                   if (mOperator != null) {
                        doCalculation(mOperator);
                        mOperator = null;
                   }
                   return Integer.toString(mResult);
               } else {
                   //
                        return null;
                    }
                }
       }


                                                                               Re:Kayo-System Co.,Ltd.

2012   2   22
(bit)

                boolean   1              true/false      FALSE

                 char     16             0   FFFF          0

                 byte     8             -128   127         0

                 short    16           -32768 32767        0

                  int     32                               0



                 long     64                               0



                 float    32                              0.0


                double    64                              0.0




                                                      Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
try {
                    Integer.parseInt(key);
                    return true;
                } catch (NumberFormatException e) {
                }
                return false;




                                  Re:Kayo-System Co.,Ltd.

2012   2   22
Ykmjuku002Activity
                                ”OK”




                                       Re:Kayo-System Co.,Ltd.

2012   2   22
package ykmjuku.android.sample.app;

   import       android.app.Activity;
   import       android.os.Bundle;
   import       android.text.Editable;
   import       android.text.TextWatcher;
   import       android.util.Log;
   import       android.view.View;
   import       android.view.View.OnClickListener;
   import       android.widget.Button;
   import       android.widget.EditText;
   import       android.widget.TextView;

   public class Ykmjuku002Activity extends Activity implements TextWatcher,
           OnClickListener {
       EditText mEditText1;
       TextView mTextView1;
       Button mButton1;
       Calculater mCalculater = new Calculater();


                                                                     Re:Kayo-System Co.,Ltd.

2012   2   22
/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

                mTextView1 = (TextView)findViewById(R.id.textView1);
                mEditText1 = (EditText)findViewById(R.id.editText1);
                mButton1 = (Button)findViewById(R.id.button1);

                mEditText1.addTextChangedListener(this);
                mButton1.setOnClickListener(this);
           }




                                                                       Re:Kayo-System Co.,Ltd.

2012   2   22
public void afterTextChanged(Editable s) {
                 String input = s.toString();
                 Log.d("Ykmjuku002Activity", "input="+input);
                 if(input.length()>0){
                     String dispText = mCalculater.putInput(input);
                     if(dispText!=null){
                         mTextView1.setText(dispText);
                     }
                     s.clear();
                 }
           }

           public void beforeTextChanged(CharSequence s, int start, int count,
                   int after) {
               // TODO Auto-generated method stub

           }

           public void onTextChanged(CharSequence s, int start, int before, int count) {
               // TODO Auto-generated method stub

           }




                                                                                           Re:Kayo-System Co.,Ltd.

2012   2    22
public void onClick(View v) {
                    String dispText = mCalculater.putInput("=");
                    if(dispText!=null){
                        mTextView1.setText(dispText);
                    }
                    mEditText1.setText(null);
                }
       }




                                                                   Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22
Re:Kayo-System Co.,Ltd.

2012   2   22

Más contenido relacionado

La actualidad más candente

Is your C# optimized
Is your C# optimizedIs your C# optimized
Is your C# optimizedWoody Pewitt
 
Let the type system be your friend
Let the type system be your friendLet the type system be your friend
Let the type system be your friendThe Software House
 
Promises generatorscallbacks
Promises generatorscallbacksPromises generatorscallbacks
Promises generatorscallbacksMike Frey
 
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Dimitrios Platis
 
重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)Chris Huang
 
Functional solid
Functional solidFunctional solid
Functional solidMatt Stine
 
Functional JavaScript for everyone
Functional JavaScript for everyoneFunctional JavaScript for everyone
Functional JavaScript for everyoneBartek Witczak
 
追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?maclean liu
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)hhliu
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
 
Mutation Testing at BzhJUG
Mutation Testing at BzhJUGMutation Testing at BzhJUG
Mutation Testing at BzhJUGSTAMP Project
 
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic LabsTypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic LabsAlfonso Peletier
 
Async js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgariaAsync js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgariaHackBulgaria
 
The Ring programming language version 1.5.1 book - Part 175 of 180
The Ring programming language version 1.5.1 book - Part 175 of 180 The Ring programming language version 1.5.1 book - Part 175 of 180
The Ring programming language version 1.5.1 book - Part 175 of 180 Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196Mahmoud Samir Fayed
 
Mutate and Test your Tests
Mutate and Test your TestsMutate and Test your Tests
Mutate and Test your TestsSTAMP Project
 

La actualidad más candente (20)

Is your C# optimized
Is your C# optimizedIs your C# optimized
Is your C# optimized
 
Encoder + decoder
Encoder + decoderEncoder + decoder
Encoder + decoder
 
(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...
(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...
(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...
 
Let the type system be your friend
Let the type system be your friendLet the type system be your friend
Let the type system be your friend
 
Promises generatorscallbacks
Promises generatorscallbacksPromises generatorscallbacks
Promises generatorscallbacks
 
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
 
重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)
 
Functional solid
Functional solidFunctional solid
Functional solid
 
Es.next
Es.nextEs.next
Es.next
 
Functional JavaScript for everyone
Functional JavaScript for everyoneFunctional JavaScript for everyone
Functional JavaScript for everyone
 
追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duo
 
Mutation Testing at BzhJUG
Mutation Testing at BzhJUGMutation Testing at BzhJUG
Mutation Testing at BzhJUG
 
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic LabsTypeScript - All you ever wanted to know - Tech Talk by Epic Labs
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
 
Async js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgariaAsync js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgaria
 
The Ring programming language version 1.5.1 book - Part 175 of 180
The Ring programming language version 1.5.1 book - Part 175 of 180 The Ring programming language version 1.5.1 book - Part 175 of 180
The Ring programming language version 1.5.1 book - Part 175 of 180
 
The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196
 
Mutate and Test your Tests
Mutate and Test your TestsMutate and Test your Tests
Mutate and Test your Tests
 

Similar a 夜子まま塾講義3(androidで電卓アプリを作る)

AndroidからWebサービスを使う
AndroidからWebサービスを使うAndroidからWebサービスを使う
AndroidからWebサービスを使うMasafumi Terazono
 
Vavr Java User Group Rheinland
Vavr Java User Group RheinlandVavr Java User Group Rheinland
Vavr Java User Group RheinlandDavid Schmitz
 
Priming Java for Speed at Market Open
Priming Java for Speed at Market OpenPriming Java for Speed at Market Open
Priming Java for Speed at Market OpenAzul Systems Inc.
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mockskenbot
 
Exceptions irst
Exceptions irstExceptions irst
Exceptions irstjkumaranc
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4Abed Bukhari
 
Transaction is a monad
Transaction is a  monadTransaction is a  monad
Transaction is a monadJarek Ratajski
 
Decision CAMP 2014 - Charles Forgy - Affecting rules performance
Decision CAMP 2014 - Charles Forgy - Affecting rules performanceDecision CAMP 2014 - Charles Forgy - Affecting rules performance
Decision CAMP 2014 - Charles Forgy - Affecting rules performanceDecision CAMP
 
Software transactional memory. pure functional approach
Software transactional memory. pure functional approachSoftware transactional memory. pure functional approach
Software transactional memory. pure functional approachAlexander Granin
 
Hypercritical C++ Code Review
Hypercritical C++ Code ReviewHypercritical C++ Code Review
Hypercritical C++ Code ReviewAndrey Karpov
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたAkira Maruoka
 

Similar a 夜子まま塾講義3(androidで電卓アプリを作る) (20)

京都Gtugコンパチapi
京都Gtugコンパチapi京都Gtugコンパチapi
京都Gtugコンパチapi
 
AndroidからWebサービスを使う
AndroidからWebサービスを使うAndroidからWebサービスを使う
AndroidからWebサービスを使う
 
Good code
Good codeGood code
Good code
 
Andy lib解説
Andy lib解説Andy lib解説
Andy lib解説
 
Vavr Java User Group Rheinland
Vavr Java User Group RheinlandVavr Java User Group Rheinland
Vavr Java User Group Rheinland
 
Priming Java for Speed at Market Open
Priming Java for Speed at Market OpenPriming Java for Speed at Market Open
Priming Java for Speed at Market Open
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mocks
 
L05if
L05ifL05if
L05if
 
Exceptions irst
Exceptions irstExceptions irst
Exceptions irst
 
JavaTalks: OOD principles
JavaTalks: OOD principlesJavaTalks: OOD principles
JavaTalks: OOD principles
 
C#, What Is Next?
C#, What Is Next?C#, What Is Next?
C#, What Is Next?
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
 
Transaction is a monad
Transaction is a  monadTransaction is a  monad
Transaction is a monad
 
Decision CAMP 2014 - Charles Forgy - Affecting rules performance
Decision CAMP 2014 - Charles Forgy - Affecting rules performanceDecision CAMP 2014 - Charles Forgy - Affecting rules performance
Decision CAMP 2014 - Charles Forgy - Affecting rules performance
 
Writing Good Tests
Writing Good TestsWriting Good Tests
Writing Good Tests
 
Software transactional memory. pure functional approach
Software transactional memory. pure functional approachSoftware transactional memory. pure functional approach
Software transactional memory. pure functional approach
 
Hypercritical C++ Code Review
Hypercritical C++ Code ReviewHypercritical C++ Code Review
Hypercritical C++ Code Review
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみた
 
Chapter 2 Java Methods
Chapter 2 Java MethodsChapter 2 Java Methods
Chapter 2 Java Methods
 
Chapter 2 Method in Java OOP
Chapter 2   Method in Java OOPChapter 2   Method in Java OOP
Chapter 2 Method in Java OOP
 

Más de Masafumi Terazono

Kobe.py 勉強会 minecraft piスライド
Kobe.py 勉強会 minecraft piスライドKobe.py 勉強会 minecraft piスライド
Kobe.py 勉強会 minecraft piスライドMasafumi Terazono
 
Minecraftと連携するSlackちゃんという会話Botを作った話
Minecraftと連携するSlackちゃんという会話Botを作った話Minecraftと連携するSlackちゃんという会話Botを作った話
Minecraftと連携するSlackちゃんという会話Botを作った話Masafumi Terazono
 
初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)
初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)
初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)Masafumi Terazono
 
夜子まま塾 2015年1月23日 進行用資料
夜子まま塾 2015年1月23日 進行用資料夜子まま塾 2015年1月23日 進行用資料
夜子まま塾 2015年1月23日 進行用資料Masafumi Terazono
 
セーラーソン振り返り
セーラーソン振り返りセーラーソン振り返り
セーラーソン振り返りMasafumi Terazono
 
関西Nfc lab勉強会 宣伝
関西Nfc lab勉強会 宣伝関西Nfc lab勉強会 宣伝
関西Nfc lab勉強会 宣伝Masafumi Terazono
 
関西支部 第二回 NFCLab勉強会 
関西支部 第二回 NFCLab勉強会 関西支部 第二回 NFCLab勉強会 
関西支部 第二回 NFCLab勉強会 Masafumi Terazono
 
日本Androidの会 中国支部資料
日本Androidの会 中国支部資料日本Androidの会 中国支部資料
日本Androidの会 中国支部資料Masafumi Terazono
 
Android+NFC 日本Androidの会神戸支部 勉強会
Android+NFC 日本Androidの会神戸支部 勉強会Android+NFC 日本Androidの会神戸支部 勉強会
Android+NFC 日本Androidの会神戸支部 勉強会Masafumi Terazono
 
関西支部Android勉強会(ロボットxnfc)
関西支部Android勉強会(ロボットxnfc)関西支部Android勉強会(ロボットxnfc)
関西支部Android勉強会(ロボットxnfc)Masafumi Terazono
 
夜子まま塾講義12(broadcast reciever)
夜子まま塾講義12(broadcast reciever)夜子まま塾講義12(broadcast reciever)
夜子まま塾講義12(broadcast reciever)Masafumi Terazono
 
夜子まま塾講義11(暗黙的intent)
夜子まま塾講義11(暗黙的intent)夜子まま塾講義11(暗黙的intent)
夜子まま塾講義11(暗黙的intent)Masafumi Terazono
 

Más de Masafumi Terazono (20)

初心者向けSpigot開発
初心者向けSpigot開発初心者向けSpigot開発
初心者向けSpigot開発
 
Minecraft dayの報告
Minecraft dayの報告Minecraft dayの報告
Minecraft dayの報告
 
BungeeCordeについて
BungeeCordeについてBungeeCordeについて
BungeeCordeについて
 
Spongeについて
SpongeについてSpongeについて
Spongeについて
 
Kobe.py 勉強会 minecraft piスライド
Kobe.py 勉強会 minecraft piスライドKobe.py 勉強会 minecraft piスライド
Kobe.py 勉強会 minecraft piスライド
 
Minecraftと連携するSlackちゃんという会話Botを作った話
Minecraftと連携するSlackちゃんという会話Botを作った話Minecraftと連携するSlackちゃんという会話Botを作った話
Minecraftと連携するSlackちゃんという会話Botを作った話
 
初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)
初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)
初心者〜中級者 Android StudioによるAndroid勉強会資料(スライド)
 
夜子まま塾 2015年1月23日 進行用資料
夜子まま塾 2015年1月23日 進行用資料夜子まま塾 2015年1月23日 進行用資料
夜子まま塾 2015年1月23日 進行用資料
 
Thetalaps
ThetalapsThetalaps
Thetalaps
 
Android wear勉強会2
Android wear勉強会2Android wear勉強会2
Android wear勉強会2
 
夜子まま塾@鹿児島
夜子まま塾@鹿児島夜子まま塾@鹿児島
夜子まま塾@鹿児島
 
セーラーソン振り返り
セーラーソン振り返りセーラーソン振り返り
セーラーソン振り返り
 
関西Nfc lab勉強会 宣伝
関西Nfc lab勉強会 宣伝関西Nfc lab勉強会 宣伝
関西Nfc lab勉強会 宣伝
 
関西支部 第二回 NFCLab勉強会 
関西支部 第二回 NFCLab勉強会 関西支部 第二回 NFCLab勉強会 
関西支部 第二回 NFCLab勉強会 
 
日本Androidの会 中国支部資料
日本Androidの会 中国支部資料日本Androidの会 中国支部資料
日本Androidの会 中国支部資料
 
Android+NFC 日本Androidの会神戸支部 勉強会
Android+NFC 日本Androidの会神戸支部 勉強会Android+NFC 日本Androidの会神戸支部 勉強会
Android+NFC 日本Androidの会神戸支部 勉強会
 
関西支部Android勉強会(ロボットxnfc)
関西支部Android勉強会(ロボットxnfc)関西支部Android勉強会(ロボットxnfc)
関西支部Android勉強会(ロボットxnfc)
 
関西Unity勉強会
関西Unity勉強会関西Unity勉強会
関西Unity勉強会
 
夜子まま塾講義12(broadcast reciever)
夜子まま塾講義12(broadcast reciever)夜子まま塾講義12(broadcast reciever)
夜子まま塾講義12(broadcast reciever)
 
夜子まま塾講義11(暗黙的intent)
夜子まま塾講義11(暗黙的intent)夜子まま塾講義11(暗黙的intent)
夜子まま塾講義11(暗黙的intent)
 

Último

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Último (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

夜子まま塾講義3(androidで電卓アプリを作る)

  • 1. Now Loading. Please Wait ... Re:Kayo-System Co.,Ltd. 2012 2 22
  • 12. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout> Re:Kayo-System Co.,Ltd. 2012 2 22
  • 19. package ykmjuku.android.sample.app; public class Calculater { StringBuilder mInputNumber = new StringBuilder(); String mOperator; int mResult = 0; private boolean isNumber(String key) { try { Integer.parseInt(key); return true; } catch (NumberFormatException e) { } return false; } Re:Kayo-System Co.,Ltd. 2012 2 22
  • 20. private boolean isSupportedOperator(String key) { if (key.equals("+")) { return true; } else if (key.equals("-")) { return true; } else if (key.equals("*")) { return true; } else if (key.equals("/")) { return true; } return false; } Re:Kayo-System Co.,Ltd. 2012 2 22
  • 21. private void doCalculation(String ope) { if (ope.equals("+")) { mResult = mResult + Integer.parseInt(mInputNumber.toString()); } else if (ope.equals("-")) { mResult = mResult - Integer.parseInt(mInputNumber.toString()); } else if (ope.equals("*")) { mResult = mResult * Integer.parseInt(mInputNumber.toString()); } else if (ope.equals("/")) { mResult = mResult / Integer.parseInt(mInputNumber.toString()); } mInputNumber = new StringBuilder(); } Re:Kayo-System Co.,Ltd. 2012 2 22
  • 22. public String putInput(String key) { if (isNumber(key)) { mInputNumber.append(key); return mInputNumber.toString(); } else if (isSupportedOperator(key)) { if (mOperator != null) { doCalculation(mOperator); mOperator = null; } else if (mInputNumber.length() > 0) { mResult = Integer.parseInt(mInputNumber.toString()); mInputNumber = new StringBuilder(); } mOperator = key; return mOperator; } else if (key.equals("=")) { if (mOperator != null) { doCalculation(mOperator); mOperator = null; } return Integer.toString(mResult); } else { // return null; } } } Re:Kayo-System Co.,Ltd. 2012 2 22
  • 23. (bit) boolean 1 true/false FALSE char 16 0 FFFF 0 byte 8 -128 127 0 short 16 -32768 32767 0 int 32 0 long 64 0 float 32 0.0 double 64 0.0 Re:Kayo-System Co.,Ltd. 2012 2 22
  • 26. try { Integer.parseInt(key); return true; } catch (NumberFormatException e) { } return false; Re:Kayo-System Co.,Ltd. 2012 2 22
  • 27. Ykmjuku002Activity ”OK” Re:Kayo-System Co.,Ltd. 2012 2 22
  • 28. package ykmjuku.android.sample.app; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Ykmjuku002Activity extends Activity implements TextWatcher, OnClickListener { EditText mEditText1; TextView mTextView1; Button mButton1; Calculater mCalculater = new Calculater(); Re:Kayo-System Co.,Ltd. 2012 2 22
  • 29. /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTextView1 = (TextView)findViewById(R.id.textView1); mEditText1 = (EditText)findViewById(R.id.editText1); mButton1 = (Button)findViewById(R.id.button1); mEditText1.addTextChangedListener(this); mButton1.setOnClickListener(this); } Re:Kayo-System Co.,Ltd. 2012 2 22
  • 30. public void afterTextChanged(Editable s) { String input = s.toString(); Log.d("Ykmjuku002Activity", "input="+input); if(input.length()>0){ String dispText = mCalculater.putInput(input); if(dispText!=null){ mTextView1.setText(dispText); } s.clear(); } } public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } Re:Kayo-System Co.,Ltd. 2012 2 22
  • 31. public void onClick(View v) { String dispText = mCalculater.putInput("="); if(dispText!=null){ mTextView1.setText(dispText); } mEditText1.setText(null); } } Re:Kayo-System Co.,Ltd. 2012 2 22