SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 夜子まま塾講義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
 

Similaire à 夜子まま塾講義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
 

Plus 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
 

Plus 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)
 

Dernier

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Dernier (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

夜子まま塾講義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