Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DSC WORKSHOP “ANDROID FOR BEGINNER #2”
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Zainal Hasan
July 29, 2018
Programming
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
DSC WORKSHOP “ANDROID FOR BEGINNER #2”
Zainal Hasan
July 29, 2018
More Decks by Zainal Hasan
See All by Zainal Hasan
Riset Operasi-Penjadwalan dengan Metode PDM
zhanang19
0
270
Other Decks in Programming
See All in Programming
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
240
Oxlintのカスタムルールの現況
syumai
6
1.1k
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
280
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
760
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
330
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
6.2k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
560
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
250
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
11
4.1k
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
170
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Code Review Best Practice
trishagee
74
20k
Paper Plane
katiecoart
PRO
1
51k
What's in a price? How to price your products and services
michaelherold
247
13k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Chasing Engaging Ingredients in Design
codingconduct
0
220
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
190
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Paper Plane (Part 1)
katiecoart
PRO
0
9k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
860
How to Think Like a Performance Engineer
csswizardry
28
2.7k
Abbi's Birthday
coloredviolet
2
8.1k
Transcript
DSC WORKSHOP “ANDROID FOR BEGINNER #2” Layouting and EventHandling on
Android
None
Views vs ViewGroup Views : • TextView • ImageView •
Button • EditText • RadioButton • Checkbox • Switch • Rating Bar • etc ViewGroup : • RelativeLayout • LinearLayout • ConstraintLayout • TableLayout • FrameLayout • etc
Views Example <TextView android:id="@+id/title_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello DSC" android:textColor="#4689C8" android:textStyle="bold"
/> Hello DSC
ViewGroup Example <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/title_text_view1" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Hello DSC" android:textColor="#4689C8" android:textStyle="bold" android:padding="16dp"/> <TextView android:id="@+id/title_text_view2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello Lagi DSC" android:textColor="#4689C8" android:textStyle="bold" android:padding="16dp"/> </LinearLayout> Hello Lagi DSC Hello DSC
ViewGroup Example (2) <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/title_text_view1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Hello DSC" android:textColor="#4689C8" android:textStyle="bold" android:padding="16dp"/> <TextView android:id="@+id/title_text_view2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello Lagi DSC" android:textColor="#4689C8" android:textStyle="bold" android:padding="16dp"/> </LinearLayout> Hello DSC Hello Lagi DSC
Common Attributes android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/title_text_view1" android:text="Hello DSC" "match_parent" “wrap_content” <custom>
like “300dp”
Padding VS Margin
Prepare Your Android Studio
Let’s Make This
Let’s Break for a Minutes
Continue to EventHandling
onClickListener (Style 1) public class MainActivity extends AppCompatActivity { private
Button tombol; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tombol = (Button) findViewById(R.id.button); tombol.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Hello DSC", Toast.LENGTH_SHORT).show(); } }); } }
onClickListener (Style 2) public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private Button tombol; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tombol = (Button) findViewById(R.id.button); tombol.setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.button : Toast.makeText(this, "Hello DSC", Toast.LENGTH_SHORT).show(); break; } } }
Intent Activity 1 Activity 2 Intent intent = new Intent(Activity1.this,
Activity2.class); startActivity(intent); startActivityForResult(intent, 123);
Intent With Data // Activity 1 String nama = "Ahok";
intent.putExtra("data_nama", nama); startActivity(intent); Activity 1 (i have data for you) Activity 2 (where???) // Activity 2 Intent intent = getIntent(); String nama = intent.getStringExtra("data_nama");
Intent With Data (2) Bundle // Activity 1 String nama1
= "Ahok"; String nama2 = "Djarot"; Bundle bundle = new Bundle(); bundle.putString("data_nama_1", nama1); bundle.putString("data_nama_2", nama2); intent.putExtras(bundle); startActivity(intent); // Activity 2 Intent intent = getIntent(); Bundle bundle = intent.getExtras(); String nama1 = bundle.getString("data_nama_1"); String nama2 = bundle.getString("data_nama_2");
Let’s do this Backend
Thank You And Keep Developing