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
Go 1.27 における memory allocation の高速化
andpad
0
300
今さら聞けない .NET CLI
htkym
0
210
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
250
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
360
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
400
リアルな遅延を測る仕様
kota_yata
1
120
プロポーザルを書いてもらう
pvcresin
0
570
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
510
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
1
510
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
560
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
3
1.6k
【デモ】Kiroで体験する仕様駆動開発|設計からコーディングまでAIと進める開発フロー
cmkudo
0
350
Featured
See All Featured
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
380
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
220
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
450
KATA
mclloyd
PRO
35
15k
Building AI with AI
inesmontani
PRO
1
1.2k
YesSQL, Process and Tooling at Scale
rocio
174
15k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
180
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
500
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Paper Plane
katiecoart
PRO
2
53k
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