Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Android開発初心者にありがちなこと
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
andfactory, inc.
October 25, 2018
Programming
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Android開発初心者にありがちなこと
ginyolithさん発表のスライドです。
andfactory, inc.
October 25, 2018
More Decks by andfactory, inc.
See All by andfactory, inc.
UIViewのレイアウト更新メソッドを整理する
andfactory
0
460
Codableあるある
andfactory
0
230
Androidエンジニアあるある
andfactory
0
270
Collectionの罠
andfactory
0
210
Cocoa Touch Frameworkあるある
andfactory
0
360
iOS開発に慣れてきた時にやりがちあるある
andfactory
0
220
社内勉強会資料 - スクラム・アジャイル開発
andfactory
0
650
Other Decks in Programming
See All in Programming
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
330
ALB ログから Trace を気合で繋げる技術
fohte
7
880
What We Talk About When We Talk About XP
m_seki
2
450
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
信頼性の目標を誰も求めてない
shubox
0
500
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
490
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
260
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
2
270
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
150
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
180
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
Leo the Paperboy
mayatellez
9
2.3k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
410
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
420
Design in an AI World
tapps
1
310
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Transcript
Android։ൃ ॳ৺ऀʹ͋Γ͕ͪͳ͜ͱ
ࣗݾհ • ໊લɿ ࢙࠸ • ॴଐɿגࣜձࣾΞΠϦοδ • ৬छɿAndroidΤϯδχΞ • LIKE
: ԻָʢΞΧϖϥʣɺࣸਅ
֓ཁ Android։ൃ࢝Ίͨͯͷ࣌ʹ • ࠔ͍ͬͯͨࣄ • ͦͷղܾࡦ Λհ
Կͯ͠ͳ͍ͷʹ Ϋϥογϡ͢Δ
None
5ISFBE͕ݪҼɾɾɾʁ
ݪҼ public class MainActivity extends Activity { TextView mTextView; @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button1 = findViewById(R.id.button1); mTextView = findViewById(R.id.textView); // ボタン1クリック時 button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new Thread(new Runnable() { @Override public void run() { mTextView.setText("hoge"); } }).start(); } });
ݪҼ public class MainActivity extends Activity { TextView mTextView; @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button1 = findViewById(R.id.button1); mTextView = findViewById(R.id.textView); // ボタン1クリック時 button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new Thread(new Runnable() { @Override public void run() { mTextView.setText("hoge"); } }).start(); } });
ؾΛ͚ͭΔࣄ • ݪҼɿ • UiThreadҎ֎͔ΒUIʢςΩετͳͲʣΛॻ͖ ͑Δࣄ͕ग़དྷͳ͍ • ରࡦɿ • UIThreadҎ֎͔ΒHandler.post(),
͘͠ runOnUiThread༻͍ͯUIΛૢ࡞͢Δɻ
ೖॻͱݱ࣮ͷΪϟοϓ
νϡʔτϦΞϧͷґଘϥΠϒϥϦ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' }
νϡʔτϦΞϧͷίʔυ public class MainActivity extends Activity { TextView mTextView; @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button1 = findViewById(R.id.button1); Button button2 = findViewById(R.id.button2); mTextView = findViewById(R.id.textView); // ボタン1クリック時 button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { button1Clicked(); } });
࣮ࡍͷґଘϥΠϒϥϦ dependencies { // App's dependencies, including test compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion" compile "com.android.support:design:$rootProject.supportLibraryVersion" compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion" compile "com.android.support:support-v4:$rootProject.supportLibraryVersion" compile "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espressoVersion" compile "com.google.guava:guava:$rootProject.guavaVersion" compile "android.arch.persistence.room:runtime:$rootProject.roomVersion" annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion" // Dagger dependencies annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion" compile "com.google.dagger:dagger:$rootProject.daggerVersion" compile "com.google.dagger:dagger-android:$rootProject.daggerVersion" compile "com.google.dagger:dagger-android-support:$rootProject.daggerVersion" annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.daggerVersion" // Dependencies for local unit tests testCompile "junit:junit:$rootProject.ext.junitVersion" testCompile "org.mockito:mockito-all:$rootProject.ext.mockitoVersion" testCompile "org.hamcrest:hamcrest-all:$rootProject.ext.hamcrestVersion" // Android Testing Support Library's runner and rules androidTestCompile "com.android.support.test:runner:$rootProject.ext.runnerVersion" androidTestCompile "com.android.support.test:rules:$rootProject.ext.rulesVersion" androidTestCompile "android.arch.persistence.room:testing:$rootProject.roomVersion" // Dependencies for Android unit tests androidTestCompile "junit:junit:$rootProject.ext.junitVersion" androidTestCompile "org.mockito:mockito-core:$rootProject.ext.mockitoVersion" androidTestCompile "com.google.dexmaker:dexmaker:$rootProject.ext.dexmakerVersion" androidTestCompile "com.google.dexmaker:dexmaker-mockito:$rootProject.ext.dexmakerVersion"
ViewModel…? public class TaskDetailViewModel extends TaskViewModel { @Nullable private TaskDetailNavigator
mTaskDetailNavigator; public TaskDetailViewModel(Context context, TasksRepository tasksRepository) { super(context, tasksRepository); } public void setNavigator(TaskDetailNavigator taskDetailNavigator) { mTaskDetailNavigator = taskDetailNavigator; } public void onActivityDestroyed() { // Clear references to avoid potential memory leaks. mTaskDetailNavigator = null; }
ֶशͷ༏ઌ 1. ΞʔΩςΫνϟ, databindingͷ͍ํ • MVVM, MVPͳͲɻMVVMͰDatabinding͕؊ͱͳΔͷͰ߹ Θͤͯ 2. ػೳՃʹ΄΅ඞਢͳϥΠϒϥϦ
• Retrofit, OkHttpͳͲ 3. Ϟμϯͳઃܭ or هड़͕ՄೳͳϥΠϒϥϦ • RxJava, AAC, dagger2, Kotlin etc…
ͳ͔ͥToast͕දࣔ͞Εͳ͍
ͳ͔ͥToast͕දࣔ͞Εͳ͍ @Override public void showToast() { Toast.makeText(HogeActivity.this, “Hoge”, Toast.LENGTH_SHORT); }
ͳ͔ͥToast͕දࣔ͞Εͳ͍ @Override public void showToast() { Toast.makeText(HogeActivity.this, “Hoge”, Toast.LENGTH_SHORT).show(); }
KotlinΛ͏ͱ… // 拡張関数を定義 fun Activity.toast(msg : String) { Toast.makeText(this, msg,
Toast.LENGTH_SHORT).show() } // Activityを継承するクラスでtoast関数を呼ぶことが可能に fun showToast() {
[email protected]
("hoge") }
ςετ͕͍͠
Context͕औಘͰ͖ͳ͍ʂ Ͱ࣮ػςετͨ͘͠ͳ͍
ରࡦ • ϥΠϒϥϦΛ͏ • Robolectric • Android Test ( Android
Jetpack ) • ຊʹContextඞཁʁ • ઃܭΛݟ͢
Thank you for listening!