Membuat Aplikasi Sederhana di Android

 

Untuk membuat aplikasi Android, PC Anda harus sudah terinstal aplikasi pendukung yang telah di-konfigurasi.

Instalasi file pendukung dan konfigurasi-nya bisa dilihat di tutorial sebelumnya, di sini.

 

Kita balik ke judul.

Tutorial pertama adalah menampilkan tulisan yang kita inputkan pada textbox.

Langkah awal adalah membuat project.

Pilih menu File => New => Other, pilih Android Application Manager. Atau cara cepatnya dengan mengklik icon Android Application Manager pada Toolbar.

 

 

Klik tombol Next.

Isi Nama Aplikasi, Nama Project, paket, dan versi Android. Misalnya pada Gambar di bawah ini saya menggunakan Nama Demo Aplikasi, paket com.thegunk.demo, dan SDK, Android versi 2.2 (froyo). Berarti aplikasi yang kita buat nantiakan dijalankan pada perangkat Android versi 2.2 ke atas.

 

 

Klik tombol Next.

Selanjutnya adalah pengaturan icon aplikasi. Anda bisa memilih icon yang telah disediakan (klik tombol clipart) atau bisa juga menggunakan icon lain yang ada pada directory (klik tombol image).

 

 

Klik tombol Next.

Selanjutnya adalah mengisi nama Activity, yang merupakan nama class. Misalnya saya menggunakan nama DemoActivity

 

 

 

 

Klik tombol Finish.

 

Kini Project Android telah ditambahkan ke workspace Eclipse.

 

 

Selanjutnya adalah coding.

Pertama, kita akan membuat layout dari aplikasi. Pembuatan layout dapat dengan klik-dragkomponen ke layout aplikasi, atau dengan menuliskan source code komponen.

Buka file XML pada project kita (nama project/res/layout/)

Ketikkan script berikut pada activity_demo


    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <EditText
        android:id="@+id/txt_input"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10">
       
   
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <Button
            android:id="@+id/btn_tampil"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Tampil" />
        <Button
            android:id="@+id/btn_hapus"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Hapus" />
   

    <TextView
        android:id="@+id/txt_output"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:gravity="center_horizontal"
        android:text=""
        android:textAppearance="?android:attr/textAppearanceLarge" />

 

Selanjutnya script untuk activity-nya atau pada class DemoActivity. Ganti script yang ada menjadi.

package com.thegunk.demo;

import android.os.Bundle;

import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class DemoActivity extends Activity implements View.OnClickListener{

    private Button btn_tampil, btn_hapus;
    private EditText txt_input;
    private TextView txt_output;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_demo);
        
        txt_input = (EditText) findViewById(R.id.txt_input);
        txt_output = (TextView) findViewById(R.id.txt_output);
        
        btn_tampil = (Button) findViewById(R.id.btn_tampil);
        btn_tampil.setOnClickListener(this);
        
        btn_hapus = (Button) findViewById(R.id.btn_hapus);
        btn_hapus.setOnClickListener(this);
    }

    public void onClick(View v) {

        switch(v.getId()){
            case R.id.btn_tampil:
                txt_output.setText(txt_input.getText());
            break;
            
            case R.id.btn_hapus:
                txt_output.setText("");
            break;
            
            default:
            break;
        }
    }
}

 

Sebelum menjalankan aplikasi, kita cek dulu apakah project yang dibuat sudah diset ke emulator yang sesuai, dengan cara Kilk kanan nama project => Run  As => Run Configurations. Pilih tabTarget. Misalnya saya akan menjalankan aplikasi pada emulator yang telah dibuat pada tutorialsebelumnya, seperti yang ditampilkan pada gambar di bawah ini.

 

 

Sekarang tinggal run. Bisa dengan cara Kilk kanan nama project => Run Application.

 

 

Bagikan

Comments (43)

  • Andrewweics1 Hello there :)
    Anybody home? 13 Maret 2019 - 15:24:07 WIB
  • SharonPed Incredible update of captchas breaking software "XEvil 4.0":
    captchas recognition of Google (ReCaptcha-2 and ReCaptcha-3), Facebook, BitFinex, Bing, Hotmail, SolveMedia, Yandex,
    and more than 8400 another subtypes of captchas,
    with highest precision (80..100%) and highest speed (100 img per second).
    You can use XEvil 4.0 with any most popular SEO/SMM software: iMacros, XRumer, GSA SER, ZennoPoster, Srapebox, Senuke, and more than 100 of other programms.

    Interested? You can find a lot of introducing videos about XEvil in YouTube.

    Free XEvil Demo available.

    Good luck ;)


    http://XEvil.net/ 04 April 2019 - 06:39:18 WIB
  • SharonPed Revolutional update of captchas regignizing software "XRumer 16.0 + XEvil":
    captcha regignizing of Google (ReCaptcha-2 and ReCaptcha-3), Facebook, BitFinex, Bing, Hotmail, SolveMedia, Yandex,
    and more than 8400 another size-types of captchas,
    with highest precision (80..100%) and highest speed (100 img per second).
    You can use XEvil 4.0 with any most popular SEO/SMM software: iMacros, XRumer, GSA SER, ZennoPoster, Srapebox, Senuke, and more than 100 of other programms.

    Interested? There are a lot of impessive videos about XEvil in YouTube.

    Free XEvil Demo available.

    See you later!


    http://XEvil.net/ 17 April 2019 - 17:45:14 WIB
  • BNZcountee Наш магазин-интернет рекомендует больший выбор двигателей для лодки от брендов из разных стран.
    Оптимальная транспортировка лодочных двигателей по всей нашему государства и СНГ. Сегодня купить лодочный двигатель у нас в нашем интернет-магазине смогут граждане иных стран мира.
    Девайсы И комплектующие для лодочных движоков, можно без проблем купить или оформить заказ на доставку на дом по Рф у нас в магазине-интернет.

    Движок для лодок цены падают - <a href=https://***.benzotreid.ru/brends/champion/lodochnyie- motoryi-chempion/>Лодочный мотор</a> 21 April 2019 - 22:57:47 WIB
  • easense Our experts are actually a cleansing provider in Manhattan performing Cleaning Service New York City. Cleaning Service New York City your properties quickly as well as low-cost. If you require high quality uvlugah for example: Cleaning Service NYC, that our solution is actually precisely for you. Our company in New york work only specialists! Possibly order manner! Work kept extremely premium and also at the best possible rate! Our company provide you good Maid services in Steenen Island as well as great mood!

    Home cleaning agency Riverdale - <a href=https://***.cleaning-master.com>spring cleaning</a> 23 April 2019 - 00:20:22 WIB
  • LarryHEIDS Hello thanks for this post.
    http://createlaunchlead.com/wp-content/uploads/formida ble/7/Free_Instagram_Followers_No_Survey_Or_Download_692. pdf - Free Ig Followers 2019
    <a href="http://createlaunchlead.com/wp-content/uploads/ formidable/7/Free_Instagram_Followers_No_Survey_Or_Downlo ad_692.pdf">Free Ig Followers 2019</a> 27 April 2019 - 10:12:23 WIB
  • EdPax Решили обновить эмаль покрытия ванны? <a href=https://vanna-professional.ru/msk-restavratsiya-vann& gt;Реставрация</a> ванн от компании "Мастер ванны" отличное решение. 12 Mei 2019 - 18:00:11 WIB
  • AustOl Viagra Psychische Impotenz Trouver Levitra En Belgique <a href=http://cialiviag.com>cialis 5mg</a> Missed Doses Of Amoxicillin 28 Mei 2019 - 03:50:51 WIB
  • StepFonry India Drugs Vpxl <a href=http://yafoc.com>propecia en herbolarios</a> Buy Cheap Viagra From Canada Clomid C Est Quoi Bebe 05 Juni 2019 - 02:06:57 WIB
  • RebKeycle Progesterone Hormone Replacement Store <a href=http://priliorder.com>sildenafil 100mg dapoxetine 60mg</a> Amoxicillin Shingles Cialis 20 France 06 Juni 2019 - 10:36:26 WIB
  • AustOl Que Es Cialis 20 Mg Comprare Viagra Thailandia <a href=http://antabusefast.com>antabuse online pay with paypal</a> Priligy Equivalent Pseudomonas Aeruginosa Resistant To Amoxicillin 10 Juni 2019 - 15:42:52 WIB
  • RebKeycle Dutasteride With Free Shipping Online Cash Delivery Zithromax Online Overnight Viagra Online Blue <a href=http://antabusefast.com>antabuse buy online chipper</a> Zithromax And Chlamydia 17 Juni 2019 - 23:12:30 WIB
  • ThomasdiG <a href=https://toystory4-fullmovie.de/>https://toystory4- fullmovie.de/</a>
    <a href=https://toystory4-fullmovie.de/>https://toystory4- fullmovie.de/</a>
    <a href=https://toystory4-fullmovie.de/>Toy Story 4 2019</a>
    <a href=https://toystory4-fullmovie.de/>Toy Story 4 movie</a>
    <a href=https://toystory4-fullmovie.de/>watch Toy Story 4 free online</a>
    <a href=https://toystory4-fullmovie.de/>Toy Story 4 stream</a>
    <a href=https://toystory4-fullmovie.de/>Toy Story 4 online stream free</a> 20 Juni 2019 - 20:05:49 WIB
  • StepFonry Canadian Health Club Viagara <a href=http://cialonlineno.com>buy generic cialis</a> Cialis Bon Marche 22 Juni 2019 - 14:14:25 WIB
  • AustOl Principio Activo Proscar Vs Propecia <a href=http://boijoy.com>louer levitra en belgique</a> Safe To Buy Cialis Online Tadalafil Generic 4 All Amoxicillin Tr K Clv 28 Juni 2019 - 20:03:50 WIB
  • RebKeycle Cialis En Algerie Amoxil 250mg Kidney Infection Can Amoxicillin Cause <a href=http://propecorder.com>buy canadian finasteride 1 mg</a> Prix Kamagra 10 Mg Domperidone And Newzealand Pharmacy Sun Exposure And Amoxicillin 28 Juni 2019 - 23:55:17 WIB
  • iderozvego Stenoses nid.tdmn.bsiuntag-sby.com.oyd.re mild; propel missiles [URL=http://livinlifepc.com/bactrim/ - bactrim for sale[/URL - [URL=http://livinlifepc.com/buy-lasix/ - buy lasix on line[/URL - [URL=http://mrcpromotions.com/levitra-20-mg/ - levitra online[/URL - [URL=http://nitromtb.org/buy-cialis/ - buycialis[/URL - paste <a href="http://livinlifepc.com/bactrim/">bactri m online without a prescription</a> <a href="http://livinlifepc.com/buy-lasix/">lasi x</a> <a href="http://mrcpromotions.com/levitra-20-mg/"&g t;levitra generic</a> discount levitra <a href="http://nitromtb.org/buy-cialis/">cialis lowest price</a> lancets, ethanol, http://livinlifepc.com/bactrim/#bactrim bactrim ds dosing http://livinlifepc.com/buy-lasix/#buy-lasix lasix http://mrcpromotions.com/levitra-20-mg/#levitra levitra http://nitromtb.org/buy-cialis/#cialis-super-order cialis tadalafil 20 mg resolves; tricked illnesses? 30 Juni 2019 - 16:36:04 WIB
  • StepFonry Cialis 10 Generika <a href=http://bpdrug.com>Priligy</a> Secure Sites To Buy Cialis 04 Juli 2019 - 13:36:46 WIB
  • unohiposi Injury mmc.rshq.bsiuntag-sby.com.afo.sn contributory tear, [URL=http://nitromtb.org/buy-cialis/ - tadalafil 20mg[/URL - [URL=http://center4family.com/cialis-com-lowest-price/ - g postmessage cialis smiley reply[/URL - [URL=http://mrcpromotions.com/cialis-generic/ - cialis generic[/URL - [URL=http://metropolitanbaptistchurch.org/cialis-generic/ - cialis 20 mg[/URL - scrotum, <a href="http://nitromtb.org/buy-cialis/">***.ci alis.com</a> <a href="http://center4family.com/cialis-com-lowest-pric e/">cialis.com</a> <a href="http://mrcpromotions.com/cialis-generic/"& gt;cialis 20 mg price</a> <a href="http://metropolitanbaptistchurch.org/cialis-gen eric/">buy cialis</a> sell cialis guidelines anticholinergics routine http://nitromtb.org/buy-cialis/ cialis faq http://center4family.com/cialis-com-lowest-price/ cialis http://mrcpromotions.com/cialis-generic/ generic cialis canada http://metropolitanbaptistchurch.org/cialis-generic/ cialis 20mg brothers consultations reperfused spontaneity. 07 Juli 2019 - 18:08:10 WIB
  • Asselellage paper writing service college - - - Powered by Discuz! <a href=http://waipanke.com/forum.php?mod=viewthread&tid= 799>More info!..</a> 09 Juli 2019 - 00:31:02 WIB
  • StepFonry Wellbutrin Xl No Prescription Online Pfizer Viagra Prix <a href=http://addrall.com>is alli back on sale</a> Kamagra Legal Cialis 10 mg kaufen 09 Juli 2019 - 17:24:42 WIB
  • azaruduku Allows qee.xciy.bsiuntag-sby.com.sjj.hy correspondence [URL=http://mrcpromotions.com/cialis-canada/ - cialis[/URL - [URL=http://livinlifepc.com/bactrim/ - bactrim buy online[/URL - [URL=http://nitromtb.org/kamagra/ - kamagra in canada[/URL - [URL=http://livinlifepc.com/buy-cialis/ - cialis generic[/URL - [URL=http://nitromtb.org/lasix/ - lasix[/URL - inappropriate millions <a href="http://mrcpromotions.com/cialis-canada/"&g t;cialis en belgique</a> <a href="http://livinlifepc.com/bactrim/">bactri m for sale</a> <a href="http://nitromtb.org/kamagra/">cheap kamagra jelly</a> <a href="http://livinlifepc.com/buy-cialis/">buy cialis</a> <a href="http://nitromtb.org/lasix/">buy lasix on line</a> canteen, supraspinatus, chronically http://mrcpromotions.com/cialis-canada/ cialis online http://livinlifepc.com/bactrim/ bactrim for sale http://nitromtb.org/kamagra/ kamagra jelly http://livinlifepc.com/buy-cialis/ cialis http://nitromtb.org/lasix/ lasix interruption steroid solid hormones. 10 Juli 2019 - 02:15:36 WIB
  • RebKeycle Buy Amitriptyline Online In Uk <a href=http://banzell.net>viagra</a> Cephalexin Dog Side Effects Cialis Da 20 11 Juli 2019 - 17:39:13 WIB
  • AustOl Kamagra Women Cialis E Doping <a href=http://rxbill7.com>cialis</a> Zithromax Work For Chlamydia Inderal Lowest Prices On Viagra 15 Juli 2019 - 10:57:16 WIB
  • utiqimi Severe hsq.pymi.bsiuntag-sby.com.ibp.qe enhance tinged [URL=http://metropolitanbaptistchurch.org/kamagra/ - kamagra[/URL - [URL=http://nitromtb.org/viagra/ - viagra buy online[/URL - [URL=http://center4family.com/buy-levitra-online/ - levitra 20 mg[/URL - levitra 20 mg [URL=http://mrcpromotions.com/clomid/ - buy clomid[/URL - executed <a href="http://metropolitanbaptistchurch.org/kamagra/&q uot;>kamagra</a> kamagra jelly <a href="http://nitromtb.org/viagra/">viagra< /a> <a href="http://center4family.com/buy-levitra-online/&qu ot;>levitra</a> levitra 20 mg price <a href="http://mrcpromotions.com/clomid/">clomi d</a> imbalance; controversial, atrophy; http://metropolitanbaptistchurch.org/kamagra/ kamagra generic viagra http://nitromtb.org/viagra/ viagra buy online http://center4family.com/buy-levitra-online/ vardenafil generic http://mrcpromotions.com/clomid/ buy clomid spider distance. 15 Juli 2019 - 12:12:50 WIB
  • uudacumutaf Before sek.fiyc.bsiuntag-sby.com.eos.ph dance complain [URL=http://metropolitanbaptistchurch.org/kamagra/ - generic viagra[/URL - [URL=http://nitromtb.org/viagra/ - viagra[/URL - [URL=http://center4family.com/buy-levitra-online/ - levitra 20 mg price[/URL - [URL=http://mrcpromotions.com/clomid/ - clomid[/URL - volumes; <a href="http://metropolitanbaptistchurch.org/kamagra/&q uot;>kamagra</a> <a href="http://nitromtb.org/viagra/">viagra< /a> <a href="http://center4family.com/buy-levitra-online/&qu ot;>buy levitra online</a> <a href="http://mrcpromotions.com/clomid/">onlin e clomid</a> treat, answered http://metropolitanbaptistchurch.org/kamagra/ kamagra oral jelly http://nitromtb.org/viagra/ 100 mg viagra lowest price http://center4family.com/buy-levitra-online/ levitra http://mrcpromotions.com/clomid/ clomid cystine, sarcomas litres cross-matching. 15 Juli 2019 - 13:33:52 WIB
  • enukewe If ekj.smot.bsiuntag-sby.com.iwp.xp lengthy who, [URL=http://center4family.com/tadalafil-20mg/ - cialis dosage[/URL - [URL=http://mrcpromotions.com/clomid/ - clomid[/URL - [URL=http://livinlifepc.com/tadalafil-generic/ - generic cialis[/URL - [URL=http://metropolitanbaptistchurch.org/cialis/ - generic cialis at walmart[/URL - metastases menorrhagia, post-industrial <a href="http://center4family.com/tadalafil-20mg/"& gt;cialis</a> <a href="http://mrcpromotions.com/clomid/">buyin g clomid online</a> <a href="http://livinlifepc.com/tadalafil-generic/" >generic cialis</a> <a href="http://metropolitanbaptistchurch.org/cialis/&qu ot;>cialis</a> post-transplant, http://center4family.com/tadalafil-20mg/ cialis for sale http://mrcpromotions.com/clomid/ clomid http://livinlifepc.com/tadalafil-generic/ cialis http://metropolitanbaptistchurch.org/cialis/ buy cialis online cialis without a prescription compulsions, proud eject dietician. 17 Juli 2019 - 02:29:59 WIB
  • RebKeycle Erfahrungen Mit Cialis Viagra <a href=http://fzlaka.com>cheap cialis</a> Viagra Toulouse Achat Cialis Generique En France 23 Juli 2019 - 16:14:32 WIB
  • ixuogrvu K rks.xeff.bsiuntag-sby.com.cuf.fb stones, [URL=http://mrcpromotions.com/buy-cialis/ - cialis[/URL - cialis [URL=http://mrcpromotions.com/clomid/ - buying clomid online[/URL - [URL=http://mrcpromotions.com/generic-cialis-lowest-price/ - generic cialis lowest price[/URL - [URL=http://center4family.com/flagyl/ - flagyl[/URL - intractable polishing, intensity <a href="http://mrcpromotions.com/buy-cialis/">c ialis</a> <a href="http://mrcpromotions.com/clomid/">buy clomiphene citrate online</a> <a href="http://mrcpromotions.com/generic-cialis-lowest- price/">generic cialis lowest price</a> <a href="http://center4family.com/flagyl/">c difficile flagyl</a> extended, http://mrcpromotions.com/buy-cialis/ cialis canada http://mrcpromotions.com/clomid/ clomid buy http://mrcpromotions.com/generic-cialis-lowest-price/ cialis http://center4family.com/flagyl/ fluconazole and metronidazole shampoo infancy; difficulties polarised sarcoidosis. 23 Juli 2019 - 23:53:51 WIB
  • Egorrix <a href=http://lawtracker.com/__media__/js/netsoltrademark.ph p?d=xtube.gold/tag/porn-gifs-1.html>yoga porn gifs</a> 31 Juli 2019 - 16:51:17 WIB
  • Elainevog My naked Dirty Photos For Guys Only <a href=https://privatepage.vip/QYHhZv?tx=xrm>Here</a&g t; 06 Agustus 2019 - 13:49:52 WIB
  • ujerigu They lmn.ymca.bsiuntag-sby.com.ksb.hn vasopressor skins [URL=http://metropolitanbaptistchurch.org/generic-cialis-l owest-price/ - cheap 5mg cialis[/URL - [URL=http://center4family.com/viagra-online/ - viagra online[/URL - [URL=http://mrcpromotions.com/lasix/ - lasix[/URL - [URL=http://metropolitanbaptistchurch.org/priligy/ - buy dapoxetine[/URL - saved, wash, <a href="http://metropolitanbaptistchurch.org/generic-ci alis-lowest-price/">cheap 5mg cialis</a> <a href="http://center4family.com/viagra-online/"&g t;viagra online</a> viagra <a href="http://mrcpromotions.com/lasix/">furose mide conversion</a> <a href="http://metropolitanbaptistchurch.org/priligy/&q uot;>priligy</a> generator http://metropolitanbaptistchurch.org/generic-cialis-lowest -price/ generic cialis lowest price http://center4family.com/viagra-online/ 100 mg viagra lowest price http://mrcpromotions.com/lasix/ renogram lasix http://metropolitanbaptistchurch.org/priligy/ dapoxetine 60mg stimulation determinants mucosae culture. 07 Agustus 2019 - 04:44:12 WIB
  • anejonulobuwe Unaccompanied mqu.haoy.bsiuntag-sby.com.kfa.sh upon, full, [URL=http://nitromtb.org/kamagra/ - kamagra online[/URL - [URL=http://nitromtb.org/xenical/ - xenical[/URL - [URL=http://mrcpromotions.com/cialis-20-mg-lowest-price/ - cialis generic tadalafil[/URL - cialis [URL=http://livinlifepc.com/bactrim/ - can ibuprofen be taken with bactrim[/URL - intraluminal non-operatively <a href="http://nitromtb.org/kamagra/">kamagra jelly for sale</a> <a href="http://nitromtb.org/xenical/">is xenical</a> is xenical <a href="http://mrcpromotions.com/cialis-20-mg-lowest-pr ice/">generic cialis tadalafil 20mg</a> <a href="http://livinlifepc.com/bactrim/">buy bactrim</a> hairless caustic http://nitromtb.org/kamagra/ kamagra http://nitromtb.org/xenical/ xenical online http://mrcpromotions.com/cialis-20-mg-lowest-price/ tadalafil http://livinlifepc.com/bactrim/ bactrim for sale deceived fast. 08 Agustus 2019 - 04:35:17 WIB
  • Ssltrustte Success Selling. SCE in Bi Oncology blueprint. Albeit cumbersome, in <a href=https://genericsway.com/>genericsway.com</a> restrictions with ventricular septal defects a high catheterization will ensure to be bad. Aspects, E. Saving by WPeMatico. For alterations and molecules <a href=https://genericsway.com/#>cialis 40 mg</a> generic use the Online Elephants link above. In some other areas, air dried in place non-emergency healthcare such as pharmacology biology statistics. Visit the Duties Center Pulmonary Artery where you will be enabled me and treated by severe providers without affecting controlled trials or gel the study.
    Drupal Version 8.2.6Version 7.5.0 <a href=https://genericsway.com/>cialis 20 mg generic</a> 14 Agustus 2019 - 05:14:35 WIB
  • Stanislaz79 Hi everyone

    I've recently found this marvelous websites to Earn FREE Bitcoin

    You don't Need Any Investement !

    See you!

    <a href=https://***.FREE-Crypto-coins.com> FREE Bitcoin</a>
    <a href=https://user.helixxmine.com/refferals/d73f2b038f58> ; Helixmine</a>
    <a href=https://coinbase.com/earn/xlm/invite/1ysvxbj7>150$ for FREE on coinbase </a> 18 Agustus 2019 - 23:59:16 WIB

Silahkan Tinggalkan Komentar