SlideShare a Scribd company logo
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

More Related Content

What's hot

Is your C# optimized
Is your C# optimizedIs your C# optimized
Is your C# optimized
Woody Pewitt
 
Encoder + decoder
Encoder + decoderEncoder + decoder
Encoder + decoder
COMSATS Abbottabad
 
(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 - ...
Microsoft Argentina y Uruguay [Official Space]
 
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
The Software House
 
Promises generatorscallbacks
Promises generatorscallbacksPromises generatorscallbacks
Promises generatorscallbacks
Mike 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 solid
Matt Stine
 
Es.next
Es.nextEs.next
Es.next
kevinsson
 
Functional JavaScript for everyone
Functional JavaScript for everyoneFunctional JavaScript for everyone
Functional JavaScript for everyone
Bartek 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 duo
The Software House
 
Mutation Testing at BzhJUG
Mutation Testing at BzhJUGMutation Testing at BzhJUG
Mutation Testing at BzhJUG
STAMP 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 Labs
Alfonso Peletier
 
Async js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgariaAsync js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgaria
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
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 210
Mahmoud 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 196
Mahmoud Samir Fayed
 
Mutate and Test your Tests
Mutate and Test your TestsMutate and Test your Tests
Mutate and Test your Tests
STAMP Project
 

What's hot (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 to 夜子まま塾講義3(androidで電卓アプリを作る)

京都Gtugコンパチapi
京都Gtugコンパチapi京都Gtugコンパチapi
京都Gtugコンパチapi
Masafumi Terazono
 
AndroidからWebサービスを使う
AndroidからWebサービスを使うAndroidからWebサービスを使う
AndroidからWebサービスを使う
Masafumi Terazono
 
Good code
Good codeGood code
Good code
Jane Prusakova
 
Andy lib解説
Andy lib解説Andy lib解説
Andy lib解説
Masafumi Terazono
 
Vavr Java User Group Rheinland
Vavr Java User Group RheinlandVavr Java User Group Rheinland
Vavr Java User Group Rheinland
David 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 Open
Azul Systems Inc.
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mocks
kenbot
 
L05if
L05ifL05if
Exceptions irst
Exceptions irstExceptions irst
Exceptions irst
jkumaranc
 
JavaTalks: OOD principles
JavaTalks: OOD principlesJavaTalks: OOD principles
JavaTalks: OOD principles
stanislav bashkirtsev
 
C#, What Is Next?
C#, What Is Next?C#, What Is Next?
C#, What Is Next?
Pieter Joost van de Sande
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
Abed Bukhari
 
Transaction is a monad
Transaction is a  monadTransaction is a  monad
Transaction is a monad
Jarek 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 performance
Decision CAMP
 
Writing Good Tests
Writing Good TestsWriting Good Tests
Writing Good Tests
Matteo Baglini
 
Software transactional memory. pure functional approach
Software transactional memory. pure functional approachSoftware transactional memory. pure functional approach
Software transactional memory. pure functional approach
Alexander Granin
 
Hypercritical C++ Code Review
Hypercritical C++ Code ReviewHypercritical C++ Code Review
Hypercritical C++ Code Review
Andrey Karpov
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみた
Akira Maruoka
 
Chapter 2 Method in Java OOP
Chapter 2   Method in Java OOPChapter 2   Method in Java OOP
Chapter 2 Method in Java OOP
Khirulnizam Abd Rahman
 
Chapter 2 Java Methods
Chapter 2 Java MethodsChapter 2 Java Methods
Chapter 2 Java Methods
Khirulnizam Abd Rahman
 

Similar to 夜子まま塾講義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 Method in Java OOP
Chapter 2   Method in Java OOPChapter 2   Method in Java OOP
Chapter 2 Method in Java OOP
 
Chapter 2 Java Methods
Chapter 2 Java MethodsChapter 2 Java Methods
Chapter 2 Java Methods
 

More from Masafumi Terazono

初心者向けSpigot開発
初心者向けSpigot開発初心者向けSpigot開発
初心者向けSpigot開発
Masafumi Terazono
 
Minecraft dayの報告
Minecraft dayの報告Minecraft dayの報告
Minecraft dayの報告
Masafumi Terazono
 
BungeeCordeについて
BungeeCordeについてBungeeCordeについて
BungeeCordeについて
Masafumi Terazono
 
Spongeについて
SpongeについてSpongeについて
Spongeについて
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
 
Thetalaps
ThetalapsThetalaps
Android wear勉強会2
Android wear勉強会2Android wear勉強会2
Android wear勉強会2
Masafumi Terazono
 
夜子まま塾@鹿児島
夜子まま塾@鹿児島夜子まま塾@鹿児島
夜子まま塾@鹿児島
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
 

More from 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)
 

Recently uploaded

Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 

Recently uploaded (20)

Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 

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