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
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
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
6.1k
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
760
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
790
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
Claspは野良GASの夢をみるか
takter00
0
190
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
100
Lessons from Spec-Driven Development
simas
PRO
0
200
Creating Composable Callables in Contemporary C++
rollbear
0
130
The NotImplementedError Problem in Ruby
koic
1
790
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
11
4.1k
Inside Stream API
skrb
1
720
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
55
8.2k
Google's AI Overviews - The New Search
badams
0
1k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
250
Are puppies a ranking factor?
jonoalderson
1
3.6k
Building Applications with DynamoDB
mza
96
7.1k
Prompt Engineering for Job Search
mfonobong
0
340
ラッコキーワード サービス紹介資料
rakko
1
3.7M
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Claude Code のすすめ
schroneko
67
230k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
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