APPENDIX. Application Store Admin. build.gradle. app/build.gradle

Size: px
Start display at page:

Download "APPENDIX. Application Store Admin. build.gradle. app/build.gradle"

Transcription

1 Application Store Admin build.gradle APPENDIX // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() dependencies { classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files allprojects { repositories { jcenter() task clean(type: Delete) { delete rootproject.builddir app/build.gradle apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.3" defaultconfig { applicationid "com.example.root.projectku" minsdkversion 17 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguardandroid.txt'), 'proguard-rules.pro' dependencies { A

2 compile filetree(dir: 'libs', include: ['*.jar']) androidtestcompile('com.android.support.test.espresso:espressocore:2.2.2', { exclude group: 'com.android.support', module: 'supportannotations' ) compile files('libs/android-async-http jar') compile files('libs/http-core-4.1.jar') compile files('libs/httpclient jar') compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.firebase:firebase-auth:9.4.0' compile 'com.google.firebase:firebase-database:9.4.0' compile 'com.google.android.gms:play-services-maps:9.4.0' compile 'com.android.support:design:25.3.0' compile 'com.google.firebase:firebase-storage:9.4.0' compile 'com.github.bumptech.glide:glide:3.7.0' testcompile 'junit:junit:4.12' apply plugin: 'com.google.gms.google-services' AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="com.example.root.projectku"> <!-- The ACCESS_COARSE/FINE_LOCATION permissions are not required to use Google Maps Android API v2, but you must specify either coarse or fine location permissions for the 'MyLocation' functionality. --> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gse RVICES" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.write_settings" /> <uses-permission android:name="android.permission.send_sms" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" B

3 android:supportsrtl="true" <activity android:name=".mainactivity"></activity> <activity android:name=".loginactivity" android:label="login" /> <activity android:name=".lokasitokoactivity" /> <meta-data android:name="com.google.android.geo.api_key" /> <activity android:name=".listorderactivity" /> <activity android:name=".homeactivity" android:nohistory="true"/> <activity android:name=".launcheractivity" android:nohistory="true"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".historyorderactivity"></activity> </application> </manifest> LoginActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.text.textutils; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; import com.google.firebase.auth.firebaseuser; C

4 public class LoginActivity extends AppCompatActivity implements View.OnClickListener { private Button btsignin; private EditText et ; private EditText etpasword; private FirebaseAuth firebaseauth; private ProgressDialog progressdialog; private FirebaseUser firebaseuser; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); et = (EditText) findviewbyid(r.id.et ); etpassword = (EditText) findviewbyid(r.id.etpassword); btsignin = (Button) findviewbyid(r.id.btsignin); progressdialog = new ProgressDialog(this); btsignin.setonclicklistener(this); private void userlogin(){ final String = et .gettext().tostring().trim(); String password = etpassword.gettext().tostring().trim(); if (TextUtils.isEmpty( )) { Toast.makeText(this, "enter please", Toast.LENGTH_LONG).show(); return; if (TextUtils.isEmpty(password)) { Toast.makeText(this, "enter password please", Toast.LENGTH_LONG).show(); return; progressdialog.setmessage("wait.."); progressdialog.show(); firebaseauth.signinwith andpassword( , password).addoncompletelistener(this, new OnCompleteListener<AuthResult>() { public void oncomplete(@nonnull Task<AuthResult> task) { progressdialog.dismiss(); if (task.issuccessful()) { finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); D

5 ); public void onclick(view view) { if(view == buttonsignin){ userlogin(); activity_login.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_height="match_parent" tools:context="com.example.root.projectku.loginactivity"> <LinearLayout android:layout_centervertical="true" android:layout_width="368dp" android:orientation="vertical" tools:layout_editor_absolutey="0dp" tools:layout_editor_absolutex="8dp"> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="user Login" android:id="@+id/textview" android:layout_gravity="center_horizontal" /> <EditText android:id="@+id/et " android:layout_margin="15dp" android:hint="enter " android:inputtype="text address" /> <EditText android:id="@+id/etpassword" android:layout_margin="15dp" android:hint="enter password" android:inputtype="textpassword" /> <Button android:id="@+id/btsignin" android:layout_margin="15dp" android:text="login" /> E

6 </LinearLayout> </android.support.constraint.constraintlayout> LauncherActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.os.handler; import android.support.v7.app.appcompatactivity; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; public class LauncherActivity extends AppCompatActivity { private FirebaseAuth firebaseauth; private static final int SPLASH_TIME = 2 * 1000; private DatabaseReference firebasetable,firebasesubtable; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_launcher); try { new Handler().postDelayed(new Runnable() { public void run() { firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ Intent intent = new Intent(LauncherActivity.this, HomeActivity.class); startactivity(intent); LauncherActivity.this.finish(); else { Intent intent = new Intent(LauncherActivity.this, MainActivity.class); startactivity(intent); LauncherActivity.this.finish();, SPLASH_TIME); catch(exception e){ public void onbackpressed() { this.finish(); super.onbackpressed(); activity_launcher.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android=" F

7 xmlns:app=" xmlns:tools=" android:layout_height="match_parent" tools:context="com.example.root.projectku.launcheractivity"> android:layout_width="wrap_content" android:text="welcome..."/> </android.support.constraint.constraintlayout> HomeActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.datasnapshot; import com.google.firebase.database.databaseerror; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import com.google.firebase.database.valueeventlistener; public class HomeActivity extends AppCompatActivity { Button btlist; Button btbarang; Button bthistory; Button btlogout; private FirebaseAuth firebaseauth; private DatabaseReference firebasetable,firebasesubtable; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); firebaseauth = FirebaseAuth.getInstance(); btbarang = (Button) findviewbyid(r.id.btbarang); btlist = (Button) findviewbyid(r.id.btlist); bthistory = (Button) findviewbyid(r.id.bthistory); btlogout = (Button) findviewbyid(r.id.btlogout); btbarang.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), LokasiTokoActivity.class)); ); btlist.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { firebasetable = FirebaseDatabase.getInstance().getReference().child("BarangToko"); G

8 firebasetable.addvalueeventlistener(new ValueEventListener() { public void ondatachange(datasnapshot snapshot) { for(datasnapshot singlesnapshot : snapshot.getchildren()) { if(singlesnapshot.child("admin").getvalue( ).tostring().equals(firebaseauth.getcurrentus er().get ().replace('.',','))) { ListOrderActivity.KEY_NAMA_TOKO=singl esnapshot.getkey().tostring(); finish(); startactivity(new Intent(getApplicationContext(), ListOrderActivity.class)); public void oncancelled(databaseerror databaseerror) { ); ); bthistory.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { firebasetable = FirebaseDatabase.getInstance().getReference().child("BarangToko"); firebasetable.addvalueeventlistener(new ValueEventListener() {//Membaca dan mendengarkan perubahan untuk seluruh konten jalur. public void ondatachange(datasnapshot snapshot) { for(datasnapshot singlesnapshot : snapshot.getchildren()) { if(singlesnapshot.child("admin").getvalue( ).tostring().equals(firebaseauth.getcurrentuser().get ().replace('.', ','))) { HistoryOrderActivity.KEY_NAMA_TOKO=si nglesnapshot.getkey().tostring(); finish(); startactivity(new Intent(getApplicationContext(), HistoryOrderActivity.class)); public void oncancelled(databaseerror databaseerror) { ); ); H

9 btlogout.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { firebaseauth.signout(); finish(); startactivity(new Intent(getApplicationContext(), LoginActivity.class)); ); activity_home.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_height="match_parent" tools:context="com.example.root.projectku.homeactivity"> <Button android:id="@+id/btlist" android:layout_width="wrap_content" android:layout_weight="1" android:text="list Order" android:layout_margintop="24dp" android:layout_below="@+id/btbarang" android:layout_centerhorizontal="true" /> <Button android:id="@+id/btbarang" android:layout_width="wrap_content" android:layout_weight="1" android:text="update Barang" android:layout_margintop="21dp" android:layout_alignparenttop="true" android:layout_alignstart="@+id/bthistory" /> <Button android:id="@+id/bthistory" android:layout_width="wrap_content" android:layout_weight="1" android:text="delivery Order" android:layout_below="@+id/btlist" android:layout_margintop="21dp" android:layout_centerhorizontal="true" /> <Button android:id="@+id/btlogout" android:layout_width="wrap_content" I

10 android:layout_weight="1" android:text="logout" android:layout_margintop="21dp" android:layout_centerhorizontal="true" /> </RelativeLayout> LokasiTokoActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.toast; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import java.util.hashmap; import java.util.map; public class LokasiTokoActivity extends AppCompatActivity { private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase=firebasedatabase.getinstance().getreference().getroot(), firebasetable, firebasesubtable, firebasesubsubtable, firebaserecord; String temp_key_id_toko,temp_key_toko,temp_key_barang; Map<String, Object> map_toko,map_barang; Button btnmenu; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_lokasi_toko); btnmenu = (Button) findviewbyid(r.id.btmenu); firebasetable = firebasedatabase.child("barangtoko"); firebasesubtable=firebasetable.child("alfamart Krakatau"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","1@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("aqua Botol 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "4500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("bango Kecap Manis 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "26000"); J

11 map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("indomilk Susu Kental Manis 370gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "9500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("aqua Botol 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "4500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Krakatau"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("filma Minyak Goreng 2L"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "2500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","2@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("tango Wafer 300gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "21000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("sariwangi Teh Celup Asli 25sachet"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "6900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); K

12 firebaserecord=firebasesubsubtable.child("rejoice Shampoo Rich 320ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "30500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("sariwangi Teh Celup Asli 25sachet"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "6900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Labuhan Raya"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("nice Facial Tissue Non Perfumed 2Ply 700gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "18900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","3@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("detol Body Wash Anti Bakteri 450ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "30900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("nature E Handbody Lotion 245ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("formula Pasta Gigi Strong Protector 2x100gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "17900"); L

13 map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamidi Sidodadi"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("rinso Anti Noda Deterjen 1kg"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "27800"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","4@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("indomie Mie Goreng"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "2000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("lifeboy Shampoo Anti Dandruff 170ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "15900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("close Up Pasta Gigi Menthol"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "15000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Point Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("so Klin Softergent Powder 800gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "14300"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); map_toko = new HashMap<String, Object>(); M

14 map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("mie Sedap Kari Spesial"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "3500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("pantene Shampo Anti Dandruff 170ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "20800"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("kraft Oreo Selection Biscuit 352gr"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "40900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Unika"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("garnier Men Acno Fight Wasabi 100ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","28900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","6@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("listerine Mouthwash Antiseptic 250ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "19500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); N

15 firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("nivea Deo Roll On Extra Whitening"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","16400"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("minute Maid Juice Pulpy 350ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","5500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret dan ATM BCA Tinjomoyo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("indomaret Beras Ramos Super 5kg"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","59900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","7@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("minyak Goreng Sania Refil 2L"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("sunligh Pencuci Piring 800ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","14500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); O

16 firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("vixal Botol Blue 800ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","14500"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("hit Insektisida Spray Orange 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","25900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Kadirojo"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","8@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("minyak Goreng Filma Refil 2L"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("pantene Shampo Anti Dandruff 170ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "20800"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("alfamart Kadirojo"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("alfamart Beras Ramos Super 5kg"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","59900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Maluku"); map_toko = new HashMap<String, Object>(); map_toko.put("admin","9@gmail,com"); map_toko.put("latitude", " "); map_toko.put("longitude", " "); P

17 firebasesubtable.updatechildren(map_toko); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("force Magic Lemon 600ml"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "23000"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Maluku"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("marjan Boudoin 500ml All Varian"); map_barang = new HashMap<String, Object>(); map_barang.put("harga", "18900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); firebasesubtable=firebasetable.child("indomaret Maluku"); firebasesubsubtable=firebasesubtable.child("barang"); firebaserecord=firebasesubsubtable.child("selamat Wafer Kaleng 200g"); map_barang = new HashMap<String, Object>(); map_barang.put("harga","15900"); map_barang.put("stok", "1000"); map_barang.put("stokmutasi", "0"); firebaserecord.updatechildren(map_barang); Toast.makeText(getApplicationContext(), "BarangToko Sukses ditambahkan", Toast.LENGTH_LONG).show(); btnmenu.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ); activity_lokasi_toko.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_height="match_parent" tools:context="com.example.root.projectku.lokasitokoactivity"> <RelativeLayout android:layout_width="wrap_content" tools:layout_editor_absolutey="4dp" tools:layout_editor_absolutex="113dp"> Q

18 <Button android:layout_width="wrap_content" android:layout_centerhorizontal="true" android:text="back to Menu" tools:layout_editor_absolutex="130dp" tools:layout_editor_absolutey="0dp" /> </RelativeLayout> </android.support.constraint.constraintlayout> ListOrderActivity.java package com.example.root.projectku; import android.app.alertdialog; import android.content.dialoginterface; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.adapterview; import android.widget.button; import android.widget.listview; import android.widget.textview; import android.widget.toast; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.childeventlistener; import com.google.firebase.database.datasnapshot; import com.google.firebase.database.databaseerror; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import com.google.firebase.database.query; import com.google.firebase.database.valueeventlistener; import java.util.arraylist; import java.util.hashmap; import java.util.iterator; public class ListOrderActivity extends AppCompatActivity { public static String KEY_NAMA_TOKO="1"; public static String KEY_ID_ORDER="2"; public static String KEY_STATUS="3"; public static String KEY_TANGGAL="4"; public static String KEY_TOTAL="5"; public static String KEY_USERNAME="6"; public static String KEY_ORDER_DETAIL="7"; private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase= FirebaseDatabase.getInstance().getReference().getRoot(),firebaseTable, firebasesubtable, firebasesubsubtable, firebaserecord, firebaserecorddetail; String tabel = "Order"; String NamaBarang = "", Qty = "", Stok="0"; int StokInt; Button btnmenu; ListView listp, mlistdata; R

19 ListOrderAdapter adapter; ArrayList<HashMap<String, String>> listrow = new ArrayList<HashMap<String, String>>(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_list_order); listp = (ListView) findviewbyid(r.id.listorder); btnmenu = (Button) findviewbyid(r.id.btmenu); firebasetable = firebasedatabase.child(tabel); firebasesubtable = firebasetable.child(key_nama_toko); Query query = firebasesubtable.orderbykey(); query.addlistenerforsinglevalueevent(new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { String namatoko = ""; String idorder = ""; String status = ""; String tanggal = ""; String total = ""; String username = ""; for (DataSnapshot singlesnapshot : datasnapshot.getchildren()) { HashMap<String, String> map = new HashMap<String, String>(); idorder = singlesnapshot.getkey().tostring(); status = singlesnapshot.child("status").getvalue().tostring(); tanggal = singlesnapshot.child("tanggal").getvalue().tostring(); total = singlesnapshot.child("total").getvalue().tostring(); username = singlesnapshot.child("username").getvalue().tostring().replace(",","."); String orderdetail = ""; for (DataSnapshot singlesnapshot2 : singlesnapshot.child("orderdetail").getchildren()) { orderdetail = orderdetail + singlesnapshot2.child("namabarang").getvalue().tostring() +"-"+singlesnapshot2.child("harga").getvalue().tostring() +"-"+singlesnapshot2.child("qty").getvalue().tostring()+"\r\n"; if(status.equals("pending")) { map.put(key_id_order, idorder); map.put(key_status, status); map.put(key_tanggal, tanggal); map.put(key_total, total); map.put(key_username, username); map.put(key_order_detail, orderdetail); listrow.add(map); adapter = new ListOrderAdapter(ListOrderActivity.this, listrow); listp.setadapter(adapter); S

20 public void oncancelled(databaseerror databaseerror) { ); listp.setonitemlongclicklistener(new AdapterView.OnItemLongClickListener() { public boolean onitemlongclick(adapterview<?> parent, final View view, final int position, long id) { new AlertDialog.Builder(ListOrderActivity.this).setTitle(getResources().getString(R.string.st atus)).setmessage(getresources().getstring(r.string. status_message)).setpositivebutton(getresources().getstring(r. string.send), new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int which) { TextView idordernya = (TextView) view.findviewbyid(r.id.tvidorder); firebaserecord=firebasesubtable.child (idordernya.gettext().tostring()); firebaserecord.child("status").setval ue("terkirim"); firebaserecorddetail= firebaserecord.child("orderdetail"); firebaserecorddetail.addchildeventlis tener(new ChildEventListener() { public void onchildadded(datasnapshot datasnapshot, String s) { Iterator i = datasnapshot.getchildren().iterator(); while (i.hasnext()) { i.next(); NamaBarang = (String) ((DataSnapshot) i.next()).getvalue(); Qty = (String) ((DataSnapshot) i.next()).getvalue(); DatabaseReference firebaserecordupdateqty = firebasedatabase.child("barangtoko").child(key_nama_toko).child("barang").child(namabarang); firebaserecordupdateqty. child("stokmutasi").setvalue(qty); public void onchildchanged(datasnapshot datasnapshot, String s) { T

21 public void onchildremoved(datasnapshot datasnapshot) { public void onchildmoved(datasnapshot datasnapshot, String s) { public void oncancelled(databaseerror databaseerror) { ); DatabaseReference fbstok = firebasedatabase.child("barangtoko").child(key_nama_toko).child("barang") ; fbstok.addlistenerforsinglevalueevent (new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { DatabaseReference fbstok2 = firebasedatabase.child("barangtoko").child(key_nama_toko).child("barang").child(datasnapshot.getkey()); for(datasnapshot singlesnapshot1 : datasnapshot.getchildren()) { String stok = singlesnapshot1.child("stok").getvalue().tostring(); String stokmutasi= singlesnapshot1.child("stokmutasi").getvalue().tostring(); int stokbaru=integer.parseint(stok)-integer.parseint(stokmutasi); public void oncancelled(databaseerror databaseerror) { ); Toast.makeText(getApplicationContext( ), "Data "+idordernya.gettext().tostring()+" Sukses disimpan", Toast.LENGTH_LONG).show(); finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ).setnegativebutton(getresources().getstring(r. string.cancel), new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int which) { TextView idordernya = (TextView) view.findviewbyid(r.id.tvidorder); U

22 firebaserecord=firebasesubtable.child (idordernya.gettext().tostring()); firebaserecord.child("status").setval ue("dibatalkan"); Toast.makeText(getApplicationContext( ), "Data "+idordernya.gettext().tostring()+" Sukses dicancel (batalkan)", Toast.LENGTH_LONG).show(); finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ).show(); return false; ); btnmenu.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ); public void onbackpressed() { this.finish(); super.onbackpressed(); ListOrderAdapter.java package com.example.root.projectku; import android.app.activity; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.textview; import java.util.arraylist; import java.util.hashmap; public class ListOrderAdapter extends BaseAdapter { private Activity activity; private ArrayList<HashMap<String, String>> data; private static LayoutInflater inflater = null; public ListOrderAdapter(Activity a, ArrayList<HashMap<String, String>> d) { activity = a; data = d; inflater = (LayoutInflater) activity.getsystemservice(context.layout_inflater_service); V

23 public int getcount() { return data.size(); public Object getitem(int position) { return position; public long getitemid(int position) { return position; public View getview(int position, View convertview, ViewGroup parent) { View vi = convertview; if (convertview == null) vi = inflater.inflate(r.layout.list_order, null); TextView tvidorder= (TextView) vi.findviewbyid(r.id.tvidorder); TextView tvstatus= (TextView) vi.findviewbyid(r.id.tvstatus); TextView tvtanggal= (TextView) vi.findviewbyid(r.id.tvtanggal); TextView tvtotal= (TextView) vi.findviewbyid(r.id.tvtotal); TextView tvusername= (TextView) vi.findviewbyid(r.id.tvusername); TextView tvorderdetail= (TextView) vi.findviewbyid(r.id.tvorderdetail); HashMap<String, String> hasil = new HashMap<String, String>(); hasil = data.get(position); tvidorder.settext(hasil.get(listorderactivity.key_id_order)); tvstatus.settext(hasil.get(listorderactivity.key_status)); tvtanggal.settext(hasil.get(listorderactivity.key_tanggal)); tvtotal.settext(hasil.get(listorderactivity.key_total)); tvusername.settext(hasil.get(listorderactivity.key_username)); tvorderdetail.settext(hasil.get(listorderactivity.key_order_deta IL)); return vi; activity_list_order.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_width="368dp" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:orientation="vertical" tools:layout_editor_absolutex="8dp" tools:layout_editor_absolutey="29dp" tools:context="com.example.root.projectku.listorderactivity"> <RelativeLayout android:layout_width="wrap_content" > <ListView W

24 android:layout_width="wrap_content" android:layout_height="445dp" android:layout_alignparentstart="true" /> <Button android:layout_width="wrap_content" android:text="back to Menu" android:layout_centerhorizontal="true" /> </RelativeLayout> </android.support.constraint.constraintlayout> list_order.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:layout_width="wrap_content" android:text="id Order: " /> android:layout_width="wrap_content" android:text="large Text" android:textappearance="?android:attr/textappearancemedium" /> </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:layout_width="wrap_content" android:text="user: " /> android:layout_width="wrap_content" X

25 android:textappearance="?android:attr/textappearancemedium" android:text="large Text" </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:layout_width="wrap_content" android:text="tanggal: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="large Text" </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:layout_width="wrap_content" android:text="total: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="large Text" </LinearLayout> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal"> android:layout_width="wrap_content" android:text="status: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="large Text" </LinearLayout> <LinearLayout Y

26 android:layout_height="match_parent" android:orientation="horizontal"> android:layout_width="wrap_content" android:text="barang: " /> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancesmall" android:text="large Text" </LinearLayout> </LinearLayout> HistoryOrderActivity.java package com.example.root.projectku; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.listview; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.datasnapshot; import com.google.firebase.database.databaseerror; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import com.google.firebase.database.query; import com.google.firebase.database.valueeventlistener; import java.util.arraylist; import java.util.hashmap; public class HistoryOrderActivity extends AppCompatActivity { public static String KEY_NAMA_TOKO="1"; public static String KEY_ID_ORDER="2"; public static String KEY_STATUS="3"; public static String KEY_TANGGAL="4"; public static String KEY_TOTAL="5"; public static String KEY_USERNAME="6"; public static String KEY_ORDER_DETAIL="7"; private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase= FirebaseDatabase.getInstance().getReference().getRoot(),firebaseTable, firebasesubtable, firebasesubsubtable, firebaserecord, firebaserecorddetail; String tabel = "Order"; String NamaBarang = "", Qty = "", Stok="0"; int StokInt; Button btnmenu; ListView listp, mlistdata; ListOrderAdapter adapter; Z

27 ArrayList<HashMap<String, String>> listrow = new ArrayList<HashMap<String, String>>(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_history_order); listp = (ListView) findviewbyid(r.id.listorder); btnmenu = (Button) findviewbyid(r.id.btmenu); firebasetable = firebasedatabase.child(tabel);// firebasesubtable = firebasetable.child(key_nama_toko);// Query query = firebasesubtable.orderbykey(); query.addlistenerforsinglevalueevent(new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { String namatoko = ""; String idorder = ""; String status = ""; String tanggal = ""; String total = ""; String username = ""; for (DataSnapshot singlesnapshot : datasnapshot.getchildren()) { HashMap<String, String> map = new HashMap<String, String>(); idorder = singlesnapshot.getkey().tostring(); status = singlesnapshot.child("status").getvalue().tostring(); tanggal = singlesnapshot.child("tanggal").getvalue().tostring(); total = singlesnapshot.child("total").getvalue().tostring(); username = singlesnapshot.child("username").getvalue().tostring().replace(",","."); String orderdetail = ""; for (DataSnapshot singlesnapshot2 : singlesnapshot.child("orderdetail").getchildren()) { orderdetail = orderdetail + singlesnapshot2.child("namabarang").getvalue().tostring() +"-"+singlesnapshot2.child("harga").getvalue().tostring() +"-"+singlesnapshot2.child("qty").getvalue().tostring()+"\r\n"; if(status.equals("terkirim")) { map.put(key_id_order, idorder); map.put(key_status, status); map.put(key_tanggal, tanggal); map.put(key_total, total); map.put(key_username, username); map.put(key_order_detail, orderdetail); listrow.add(map); adapter = new ListOrderAdapter(HistoryOrderActivity.this, listrow); listp.setadapter(adapter); AA

28 public void oncancelled(databaseerror databaseerror) { ); btnmenu.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { finish(); startactivity(new Intent(getApplicationContext(), HomeActivity.class)); ); public void onbackpressed() { this.finish(); super.onbackpressed(); activity_history_order.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_height="match_parent" tools:context="com.example.root.projectku.historyorderactivity"> <RelativeLayout android:layout_width="wrap_content" > <ListView android:id="@+id/listorder" android:layout_width="wrap_content" android:layout_height="445dp" android:layout_alignparentstart="true" /> <Button android:layout_width="wrap_content" android:id="@+id/btmenu" android:text="back to Menu" android:layout_below="@+id/listorder" android:layout_centerhorizontal="true" /> </RelativeLayout> </android.support.constraint.constraintlayout> AB

29 Application Customer AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=" package="com.example.root.client"> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gse RVICES" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.write_settings" /> <uses-permission android:name="android.permission.send_sms" /> <application android:allowbackup="true" android:supportsrtl="true" <!-- The API key for Google Maps-based APIs is defined as a string resource. (See the file "res/values/google_maps_api.xml"). Note that the API key is linked to the encryption key used to sign the APK. You need a different API key for each encryption key, including the release key that is used to sign the APK for publishing. You can define the keys for the debug and release targets in src/debug/ and src/release/. --> <meta-data android:name="com.google.android.geo.api_key" android:value="@string/google_maps_key" /> <activity android:name=".mainactivity" android:label="@string/register"> </activity> <activity AC

30 android:name=".loginactivity" <intent-filter> android:name="android.intent.action.main" /> <action <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".menuactivity" /> <activity android:name=".orderactivity" /> <activity android:name=".productactivity" /> <activity android:name=".shoppingcartactivity" /> </application> </manifest> build.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() dependencies { classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files allprojects { repositories { jcenter() task clean(type: Delete) { delete rootproject.builddir app/build.gradle apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.3" defaultconfig { AD

31 applicationid "com.example.root.client" minsdkversion 17 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguardandroid.txt'), 'proguard-rules.pro' dependencies { compile filetree(dir: 'libs', include: ['*.jar']) androidtestcompile('com.android.support.test.espresso:espressocore:2.2.2', { exclude group: 'com.android.support', module: 'supportannotations' ) compile files('libs/android-async-http jar') compile files('libs/http-core-4.1.jar') compile files('libs/httpclient jar') compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.firebase:firebase-auth:9.4.0' compile 'com.google.firebase:firebase-database:9.4.0' compile 'com.google.android.gms:play-services-maps:9.4.0' compile 'com.android.support:design:25.3.0' compile 'com.google.firebase:firebase-storage:9.4.0' compile 'com.github.bumptech.glide:glide:3.7.0' testcompile 'junit:junit:4.12' apply plugin: 'com.google.gms.google-services' adapter/cartitemadapter.java package com.example.root.projectku.adapter; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.textview; import com.example.root.projectku.r; import com.example.root.projectku.constant.constant; import com.example.root.projectku.model.cart; import com.example.root.projectku.model.cartitem; import com.example.root.projectku.util.carthelper; import java.math.bigdecimal; import java.text.decimalformat; AE

32 import java.text.decimalformatsymbols; import java.util.collections; import java.util.list; import java.util.locale; public class CartItemAdapter extends BaseAdapter { private static final String TAG = "CartItemAdapter"; private List<CartItem> cartitems = Collections.emptyList(); private final Context context; public CartItemAdapter(Context context) { this.context = context; public void updatecartitems(list<cartitem> cartitems) { this.cartitems = cartitems; notifydatasetchanged(); public int getcount() { return cartitems.size(); public CartItem getitem(int position) { return cartitems.get(position); public long getitemid(int position) { return position; public View getview(final int position, View convertview, ViewGroup parent) { TextView tvname; TextView tvunitprice; TextView tvquantity; TextView tvprice; if (convertview == null) { convertview = LayoutInflater.from(context).inflate(R.layout.adapter_cart_item, parent, false); tvname = (TextView) convertview.findviewbyid(r.id.tvcartitemname); tvunitprice = (TextView) convertview.findviewbyid(r.id.tvcartitemunitprice); tvquantity = (TextView) convertview.findviewbyid(r.id.tvcartitemquantity); tvprice = (TextView) convertview.findviewbyid(r.id.tvcartitemprice); convertview.settag(new ViewHolder(tvName, tvunitprice, tvquantity, tvprice)); else { ViewHolder viewholder = (ViewHolder) convertview.gettag(); tvname = viewholder.tvcartitemname; tvunitprice = viewholder.tvcartitemunitprice; tvquantity = viewholder.tvcartitemquantity; tvprice = viewholder.tvcartitemprice; AF

33 final Cart cart = CartHelper.getCart(); final CartItem cartitem = getitem(position); tvname.settext(cartitem.getproduct().getname()); DecimalFormat df = new DecimalFormat("#,##0", DecimalFormatSymbols.getInstance(Locale.ITALY)); tvunitprice.settext(constant.currency+string.valueof(df.format(c artitem.getproduct().getprice().setscale(0, BigDecimal.ROUND_HALF_UP)))); tvquantity.settext(string.valueof(cartitem.getquantity())); tvprice.settext(constant.currency+string.valueof(df.format(cart. getcost(cartitem.getproduct()).setscale(0, BigDecimal.ROUND_HALF_UP)))); return convertview; private static class ViewHolder { public final TextView tvcartitemname; public final TextView tvcartitemunitprice; public final TextView tvcartitemquantity; public final TextView tvcartitemprice; public ViewHolder(TextView tvcartitemname, TextView tvcartitemunitprice, TextView tvcartitemquantity, TextView tvcartitemprice) { this.tvcartitemname = tvcartitemname; this.tvcartitemunitprice = tvcartitemunitprice; this.tvcartitemquantity = tvcartitemquantity; this.tvcartitemprice = tvcartitemprice; adapter_cart_item.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_margin="5dp" android:minheight="50dp" android:orientation="horizontal" android:weightsum="1"> android:id="@+id/tvcartitemname" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.4" android:gravity="center" android:text=""/> android:id="@+id/tvcartitemunitprice" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.2" AG

34 android:gravity="center" android:text=""/> android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.15" android:gravity="center"/> android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.25" android:gravity="center" android:text=""/> </LinearLayout> adapter/productadapter.java package com.example.root.projectku.adapter; import android.content.context; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.imageview; import android.widget.textview; import com.example.root.projectku.r; import com.example.root.projectku.constant.constant; import com.example.root.projectku.model.product; import java.math.bigdecimal; import java.util.arraylist; import java.util.list; public class ProductAdapter extends BaseAdapter { private static final String TAG = "ProductAdapter"; private List<Product> products = new ArrayList<Product>(); private final Context context; public ProductAdapter(Context context) { this.context = context; public void updateproducts(list<product> products) { this.products.addall(products); notifydatasetchanged(); public int getcount() { return products.size(); public Product getitem(int position) { return products.get(position); AH

35 public long getitemid(int position) { return position; public View getview(int position, View convertview, ViewGroup parent) { TextView tvname; TextView tvprice; ImageView ivimage; if (convertview == null) { convertview = LayoutInflater.from(context).inflate(R.layout.adapter_product, parent, false); tvname = (TextView) convertview.findviewbyid(r.id.tvproductname); tvprice = (TextView) convertview.findviewbyid(r.id.tvproductprice); ivimage = (ImageView) convertview.findviewbyid(r.id.ivproductimage); convertview.settag(new ViewHolder(tvName, tvprice, ivimage)); else { ViewHolder viewholder = (ViewHolder) convertview.gettag(); tvname = viewholder.tvproductname; tvprice = viewholder.tvproductprice; ivimage = viewholder.ivproductimage; final Product product = getitem(position); tvname.settext(product.getname()); tvprice.settext(constant.currency+string.valueof(product.getpric e().setscale(2, BigDecimal.ROUND_HALF_UP))); Log.d(TAG, "Context package name: " + context.getpackagename()); ivimage.setimageresource(context.getresources().getidentifier( product.getimagename(), "drawable", context.getpackagename())); return convertview; private static class ViewHolder { public final TextView tvproductname; public final TextView tvproductprice; public final ImageView ivproductimage; public ViewHolder(TextView tvproductname, TextView tvproductprice, ImageView ivproductimage) { this.tvproductname = tvproductname; this.tvproductprice = tvproductprice; this.ivproductimage = ivproductimage; AI

36 adapter_product.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_margin="5dp" android:minheight="50dp" android:orientation="horizontal" android:weightsum="1"> android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.50" android:gravity="center" android:text=""/> <ImageView android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.25" android:gravity="center"/> android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="0.25" android:gravity="center" android:text=""/> </LinearLayout> constant/constant.java package com.example.root.projectku.constant; import java.util.arraylist; import java.util.list; public class Constant { public static final List<Integer> QUANTITY_LIST = new ArrayList<Integer>(); public static final String CURRENCY = "Rp. "; model/cart.java package com.example.root.projectku.model; import java.io.serializable; import java.math.bigdecimal; import java.util.hashmap; import java.util.map; AJ

37 import java.util.map.entry; import java.util.set; /** * A representation of shopping cart. * <p/> * A shopping cart has a map of {@link Saleable products to their corresponding quantities. */ public class Cart implements Serializable { private static final long serialversionuid = 42L; private Map<Saleable, Integer> cartitemmap = new HashMap<Saleable, Integer>(); private BigDecimal totalprice = BigDecimal.ZERO; private int totalquantity = 0; /** * Add a quantity of a certain {@link Saleable product to this shopping cart * sellable the product will be added to this shopping cart quantity the amount to be added */ public void add(final Saleable sellable, int quantity) { if (cartitemmap.containskey(sellable)) { cartitemmap.put(sellable, cartitemmap.get(sellable) + quantity); else { cartitemmap.put(sellable, quantity); totalprice = totalprice.add(sellable.getprice().multiply(bigdecimal.valueof(quantity)) ); totalquantity += quantity; /** * Set new quantity for a {@link Saleable product in this shopping cart * sellable the product which quantity will be updated quantity the new quantity will be assigned for the product ProductNotFoundException if the product is not found in this shopping cart. QuantityOutOfRangeException if the quantity is negative */ //throws memberitahu bahwa method yang bersangkutan dapat melempar eksepsi dengan tipe yang dideklarasikan public void update(final Saleable sellable, int quantity) throws ProductNotFoundException, QuantityOutOfRangeException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); if (quantity < 0) throw new QuantityOutOfRangeException(quantity + " is not a valid quantity. It must be non-negative."); int productquantity = cartitemmap.get(sellable); BigDecimal productprice = sellable.getprice().multiply(bigdecimal.valueof(productquantity)); AK

38 cartitemmap.put(sellable, quantity); totalquantity = totalquantity - productquantity + quantity; totalprice = totalprice.subtract(productprice).add(sellable.getprice().multiply(bigdec imal.valueof(quantity))); /** * Remove a certain quantity of a {@link Saleable product from this shopping cart * sellable the product which will be removed quantity the quantity of product which will be removed ProductNotFoundException if the product is not found in this shopping cart QuantityOutOfRangeException if the quantity is negative or more than the existing quantity of the product in this shopping cart */ public void remove(final Saleable sellable, int quantity) throws ProductNotFoundException, QuantityOutOfRangeException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); int productquantity = cartitemmap.get(sellable); if (quantity < 0 quantity > productquantity) throw new QuantityOutOfRangeException(quantity + " is not a valid quantity. It must be non-negative and less than the current quantity of the product in the shopping cart."); if (productquantity == quantity) { cartitemmap.remove(sellable); else { cartitemmap.put(sellable, productquantity - quantity); totalprice = totalprice.subtract(sellable.getprice().multiply(bigdecimal.valueof(quant ity))); totalquantity -= quantity; /** * Remove a {@link Saleable product from this shopping cart totally * sellable the product to be removed ProductNotFoundException if the product is not found in this shopping cart */ public void remove(final Saleable sellable) throws ProductNotFoundException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); int quantity = cartitemmap.get(sellable); cartitemmap.remove(sellable); totalprice = totalprice.subtract(sellable.getprice().multiply(bigdecimal.valueof(quant ity))); totalquantity -= quantity; /** AL

39 * Remove all products from this shopping cart */ public void clear() { cartitemmap.clear(); totalprice = BigDecimal.ZERO; totalquantity = 0; /** * Get quantity of a {@link Saleable product in this shopping cart * sellable the product of interest which this method will return the quantity The product quantity in this shopping cart ProductNotFoundException if the product is not found in this shopping cart */ public int getquantity(final Saleable sellable) throws ProductNotFoundException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); return cartitemmap.get(sellable); /** * Get total cost of a {@link Saleable product in this shopping cart * sellable the product of interest which this method will return the total cost Total cost of the product ProductNotFoundException if the product is not found in this shopping cart */ public BigDecimal getcost(final Saleable sellable) throws ProductNotFoundException { if (!cartitemmap.containskey(sellable)) throw new ProductNotFoundException(); return sellable.getprice().multiply(bigdecimal.valueof(cartitemmap.get(sellable) )); /** * Get total price of all products in this shopping cart * Total price of all products in this shopping cart */ public BigDecimal gettotalprice() { return totalprice; /** * Get total quantity of all products in this shopping cart * Total quantity of all products in this shopping cart */ public int gettotalquantity() { return totalquantity; AM

40 /** * Get set of products in this shopping cart * Set of {@link Saleable products in this shopping cart */ public Set<Saleable> getproducts() { return cartitemmap.keyset(); /** * Get a map of products to their quantities in the shopping cart * A map from product to its quantity in this shopping cart */ public Map<Saleable, Integer> getitemwithquantity() { Map<Saleable, Integer> cartitemmap = new HashMap<Saleable, Integer>(); cartitemmap.putall(this.cartitemmap); return cartitemmap; public String tostring() { StringBuilder strbuilder = new StringBuilder(); for (Entry<Saleable, Integer> entry : cartitemmap.entryset()) { strbuilder.append(string.format("product: %s, Unit Price: %f, Quantity: %d%n", entry.getkey().getname(), entry.getkey().getprice(), entry.getvalue())); strbuilder.append(string.format("total Quantity: %d, Total Price: %f", totalquantity, totalprice)); return strbuilder.tostring(); public class ProductNotFoundException extends RuntimeException { private static final long serialversionuid = 43L; private static final String DEFAULT_MESSAGE = "Product is not found in the shopping cart."; public ProductNotFoundException() { super(default_message); public ProductNotFoundException(String message) { super(message); public class QuantityOutOfRangeException extends RuntimeException { private static final long serialversionuid = 44L; private static final String DEFAULT_MESSAGE = "Quantity is out of range"; public QuantityOutOfRangeException() { super(default_message); public QuantityOutOfRangeException(String message) { super(message); AN

41 model/cartitem.java package com.example.root.projectku.model; public class CartItem { private Product product; private int quantity; public int getquantity() { return quantity; public void setquantity(int quantity) { this.quantity = quantity; public Product getproduct() { return product; public void setproduct(product product) { this.product = product; model/product.java package com.example.root.projectku.model; import java.io.serializable; import java.math.bigdecimal; public class Product implements Saleable, Serializable { private static final long serialversionuid = L; private int pid; private String pname; private BigDecimal pprice; private String pdescription; private String pimagename; public Product() { super(); public Product(int pid, String pname, BigDecimal pprice, String pdescription, String pimagename) { setid(pid); setname(pname); setprice(pprice); setdescription(pdescription); setimagename(pimagename); public boolean equals(object o) { if (o == null) return false; if (!(o instanceof Product)) return false; return (this.pid == ((Product) o).getid()); public int hashcode() { final int prime = 31; int hash = 1; AO

42 hash = hash * prime + pid; hash = hash * prime + (pname == null? 0 : pname.hashcode()); hash = hash * prime + (pprice == null? 0 : pprice.hashcode()); hash = hash * prime + (pdescription == null? 0 : pdescription.hashcode()); return hash; public int getid() { return pid; public void setid(int id) { this.pid = id; public BigDecimal getprice() { return pprice; public String getname() { return pname; public void setprice(bigdecimal price) { this.pprice = price; public void setname(string name) { this.pname = name; public String getdescription() { return pdescription; public void setdescription(string pdescription) { this.pdescription = pdescription; public String getimagename() { return pimagename; public void setimagename(string imagename) { this.pimagename = imagename; model/saleable.java package com.example.root.projectku.model; import java.math.bigdecimal; /** * Implements this interface for any product which can be added to shopping cart */ public interface Saleable { BigDecimal getprice(); String getname(); int getid(); AP

43 model/carthelper.java package com.example.root.projectku.util; import com.example.root.projectku.model.cart; /** * A helper class to retrieve the static shopping cart. Call {@code getcart() to retrieve the shopping cart before you perform any operation on the shopping cart. * * */ public class CartHelper { private static Cart cart = new Cart(); /** * Retrieve the shopping cart. Call this before perform any manipulation on the shopping cart. * the shopping cart */ public static Cart getcart() { if (cart == null) { cart = new Cart(); return cart; MainActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.text.textutils; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import java.util.hashmap; import java.util.map; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private EditText et ; private EditText etpassword; private EditText etnama, etalamat, ettelp; AQ

44 private Button btsignin; private TextView tvsignin; private ProgressDialog pdialog; private FirebaseAuth firebaseauth; private DatabaseReference firebasetable,firebasesubtable; String tabel_akun="akun"; String temp_key_akun,temp_key_auth,temp_key_nama,temp_key_alamat,temp_key_telp; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); et = (EditText) findviewbyid(r.id.et ); etpassword = (EditText) findviewbyid(r.id.etpassword); etnama= (EditText) findviewbyid(r.id.etnama); etalamat = (EditText) findviewbyid(r.id.etalamat); ettelp = (EditText) findviewbyid(r.id.ettelp); tvsignin = (TextView) findviewbyid(r.id.tvsignin); btsignup = (Button) findviewbyid(r.id.btsignup); pdialog = new ProgressDialog(this); buttonsignup.setonclicklistener(this); textviewsignin.setonclicklistener(this); private void registeruser(){ String = et .gettext().tostring().trim(); String password = etpassword.gettext().tostring().trim(); if(textutils.isempty( )){ Toast.makeText(this,"enter please",toast.length_long).show(); return; if(textutils.isempty(password)){ Toast.makeText(this,"enter password please",toast.length_long).show(); return; pdialog.setmessage("registering Please Wait..."); pdialog.show(); firebaseauth.createuserwith andpassword( , password).addoncompletelistener(this, new OnCompleteListener<AuthResult>() { public void oncomplete(@nonnull Task<AuthResult> task) { if(task.issuccessful()){ firebasetable = FirebaseDatabase.getInstance().getReference().child(tabel_akun); AR

45 temp_key_akun=edittext .gettext().tost ring().trim().replace('.',','); Map<String, Object> map_user = new HashMap<String, Object>(); map_user.put(temp_key_akun, ""); firebasetable.updatechildren(map_user); temp_key_auth=firebaseauth.getcurrentuser( ).get ().replace('.',','); firebasetable = FirebaseDatabase.getInstance().getReference().child(tabel_akun); firebasesubtable = firebasetable.child(temp_key_auth); temp_key_nama= etnama.gettext().tostring().trim(); temp_key_alamat= etalamat.gettext().tostring().trim(); temp_key_telp= ettelp.gettext().tostring().trim(); Map<String, Object> map_data = new HashMap<String, Object>(); map_data.put("name", temp_key_nama); map_data.put("address", temp_key_alamat); map_data.put("phone", temp_key_telp); firebasesubtable.updatechildren(map_data); finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); else{ Toast.makeText(MainActivity.this,"Registra tion Error",Toast.LENGTH_LONG).show(); pdialog.dismiss(); ); public void onclick(view view) { if(view == btsignup){ registeruser(); if(view == tvsignin){ startactivity(new Intent(this, LoginActivity.class)); activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_width="368dp" AS

46 android:layout_centerhorizontal="true" android:layout_centervertical="true" android:orientation="vertical" tools:layout_editor_absolutex="16dp" tools:layout_editor_absolutey="119dp"> android:textappearance="?android:attr/textappearancelarge" android:text="user Registration" android:textalignment="center" tools:layout_editor_absolutex="8dp" tools:layout_editor_absolutey="0dp" /> <EditText android:layout_margin="15dp" android:hint="enter your " android:inputtype="text address" /> <EditText android:layout_margin="15dp" android:hint="enter your password" android:inputtype="textpassword" /> <EditText android:layout_margin="15dp" android:hint="enter your name" /> <EditText android:layout_margin="15dp" android:hint="enter your address" /> <EditText android:layout_margin="15dp" android:hint="enter your phone number" android:inputtype="number phone" /> <Button android:layout_margin="15dp" android:text="signup" /> AT

47 android:textalignment="center" android:text="already Registered? Sign in here" /> </LinearLayout> LoginActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.text.textutils; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; import com.google.firebase.auth.firebaseuser; public class LoginActivity extends AppCompatActivity implements View.OnClickListener { private Button btsignin; private EditText et ; private EditText etpassword; private TextView tvsignup; private FirebaseAuth firebaseauth; private ProgressDialog progressdialog; private FirebaseUser firebaseuser; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); firebaseauth = FirebaseAuth.getInstance(); if(firebaseauth.getcurrentuser()!= null){ finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); et = (EditText) findviewbyid(r.id.et ); etpassword = (EditText) findviewbyid(r.id.etpassword); btsignin = (Button) findviewbyid(r.id.btsignin); tvsignup = (TextView) findviewbyid(r.id.tvsignup); progressdialog = new ProgressDialog(this); btsignin.setonclicklistener(this); AU

48 tvsignup.setonclicklistener(this); private void userlogin(){ final String = et .gettext().tostring().trim(); String password = etpassword.gettext().tostring().trim(); if (TextUtils.isEmpty( )) { Toast.makeText(this, "enter please", Toast.LENGTH_LONG).show(); return; if (TextUtils.isEmpty(password)) { Toast.makeText(this, "enter password please", Toast.LENGTH_LONG).show(); return; progressdialog.setmessage("wait.."); progressdialog.show(); firebaseauth.signinwith andpassword( , password).addoncompletelistener(this, new OnCompleteListener<AuthResult>() { public void oncomplete(@nonnull Task<AuthResult> task) { progressdialog.dismiss(); if (task.issuccessful()) { finish(); startactivity(new Intent(getApplicationContext(), MenuActivity.class)); ); public void onclick(view view) { if(view == btsignin){ userlogin(); if(view == tvsignup){ finish(); startactivity(new Intent(this, MainActivity.class)); activity_login.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_centervertical="true" android:layout_width="368dp" AV

49 android:orientation="vertical" tools:layout_editor_absolutey="0dp" tools:layout_editor_absolutex="8dp"> android:layout_width="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="user Login" android:layout_gravity="center_horizontal" /> <EditText android:layout_margin="15dp" android:hint="enter " android:inputtype="text address" /> <EditText android:layout_margin="15dp" android:hint="enter password" android:inputtype="textpassword" /> <Button android:layout_margin="15dp" android:text="login" /> android:text="don t have an account? Signup Here" android:id="@+id/tvsignup" android:textalignment="center" android:layout_margin="15dp" /> </LinearLayout> AppLocationService.java package com.example.root.client; import android.app.service; import android.content.context; import android.content.intent; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.os.ibinder; AW

50 public class AppLocationService extends Service implements LocationListener { protected LocationManager lm; Location loc; private static final long MIN_DISTANCE_FOR_UPDATE = 10; private static final long MIN_TIME_FOR_UPDATE = 1000 * 60 * 2; public AppLocationService(Context context) { lm = (LocationManager) public Location getlocation(string provider) { if (lm.isproviderenabled(provider)) { lm.requestlocationupdates(provider,min_time_for_update, MIN_DISTANCE_FOR_UPDATE, this); if (lm!= null) { loc = lm.getlastknownlocation(provider); return loc; return null; public void onlocationchanged(location location) { public void onproviderdisabled(string provider) { public void onproviderenabled(string provider) { public void onstatuschanged(string provider, int status, Bundle extras) { public IBinder onbind(intent arg0) { return null; MenuActivity.java package com.example.root.client; import android.app.progressdialog; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.pm.packagemanager; import android.location.location; import android.location.locationmanager; import android.os.bundle; import android.os.strictmode; import android.provider.settings; AX

51 import android.support.design.widget.floatingactionbutton; import android.support.design.widget.navigationview; import android.support.design.widget.snackbar; import android.support.v4.app.activitycompat; import android.support.v4.view.gravitycompat; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbardrawertoggle; import android.support.v7.app.alertdialog; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.linearlayout; import android.widget.textview; import android.widget.toast; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.childeventlistener; import com.google.firebase.database.datasnapshot; import com.google.firebase.database.databaseerror; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import com.loopj.android.http.asynchttpclient; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httpget; import org.apache.http.impl.client.defaulthttpclient; import org.json.jsonarray; import org.json.jsonobject; import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; import java.util.hashmap; import java.util.iterator; import java.util.map; public class MenuActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, OnMapReadyCallback { private String xresult = ""; private JSONObject jobject; private GoogleMap mmap; private FirebaseAuth firebaseauth = FirebaseAuth.getInstance(); private DatabaseReference firebasedatabase=firebasedatabase.getinstance().getreference().getroot(), firebasetable, firebasesubtable, firebasesubsubtable, firebaserecord; String tabel = "LokasiToko"; String temp_key_authuser, temp_key_toko; AY

52 Map<String, Object> map_toko; AsyncHttpClient client = new AsyncHttpClient(); int limitdistance = 1500; int thenearestdistance = ; LatLng lokasiku, lokasiminimarket; String nama = ""; String admin = ""; String barang = ""; String latitude = ""; String longitude = ""; HashMap<String, LatLng> lokasifiltered = new HashMap<String, LatLng>(); private ProgressDialog pdialog; TextView td; LinearLayout llmap; AppLocationService applocservice; double currentlatitude; double currentlongitude; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_menu); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); SupportMapFragment mapfragment = (SupportMapFragment) getsupportfragmentmanager().findfragmentbyid(r.id.mapfragment); mapfragment.getmapasync(this); Toolbar toolbar = (Toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); FloatingActionButton fab = (FloatingActionButton) findviewbyid(r.id.fab); fab.setvisibility(view.gone); fab.setonclicklistener(new View.OnClickListener() { public void onclick(view view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show(); ); DrawerLayout drawer = (DrawerLayout) findviewbyid(r.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setdrawerlistener(toggle); toggle.syncstate(); NavigationView navigationview = (NavigationView) findviewbyid(r.id.nav_view); navigationview.setnavigationitemselectedlistener(this); td = (TextView) findviewbyid(r.id.tvdialog); llmap = (LinearLayout) findviewbyid(r.id.llmap); AZ

53 private void showsettingsalert(string provider) { AlertDialog.Builder alertdialog = new AlertDialog.Builder( MenuActivity.this); alertdialog.settitle(provider + "SETTINGS"); alertdialog.setmessage(provider + "is not enable! Want to go to settings menu?"); alertdialog.setpositivebutton("settings", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int which) { Intent intent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTI NGS); MenuActivity.this.startActivity(intent); ); alertdialog.setnegativebutton("cancel", new DialogInterface.OnClickListener(){ public void onclick(dialoginterface dialog, int which) { dialog.cancel(); ); alertdialog.show(); public void onbackpressed() { DrawerLayout drawer = (DrawerLayout) findviewbyid(r.id.drawer_layout); if (drawer.isdraweropen(gravitycompat.start)) { drawer.closedrawer(gravitycompat.start); else { super.onbackpressed(); public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.menu, menu); return true; public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if (id == R.id.action_settings) { return true; return public boolean onnavigationitemselected(menuitem item) { int id = item.getitemid(); BA

54 if (id == R.id.nav_order) { startactivity(new Intent(getApplicationContext(), MenuActivity.class)); finish(); if (id == R.id.nav_profile) { startactivity(new Intent(getApplicationContext(), ProfileActivity.class)); else if (id == R.id.nav_cart) { startactivity(new Intent(getApplicationContext(), ShoppingCartActivity.class)); else if(id == R.id.nav_logout) { firebaseauth.signout(); finish(); startactivity(new Intent(this, MainActivity.class)); DrawerLayout drawer = (DrawerLayout) findviewbyid(r.id.drawer_layout); drawer.closedrawer(gravitycompat.start); return true; public void onmapready(googlemap googlemap) { mmap = googlemap; mmap.setoninfowindowclicklistener(new GoogleMap.OnInfoWindowClickListener() { public void oninfowindowclick(marker marker) { String idc = marker.gettitle(); OrderActivity.NAMA_TOKO = idc; startactivity(new Intent(getApplicationContext(), OrderActivity.class)); ); applocservice=new AppLocationService(MenuActivity.this); Location gpslocation = applocservice.getlocation(locationmanager.gps_provider); if (gpslocation!= null){ currentlatitude = gpslocation.getlatitude(); currentlongitude = gpslocation.getlongitude(); else { showsettingsalert("gps ALERT"); lokasiku = new LatLng(currentLatitude, currentlongitude); pdialog = new ProgressDialog(MenuActivity.this); pdialog.setmessage("getting Data..."); pdialog.setindeterminate(false); BB

55 pdialog.setcancelable(true); pdialog.show(); try { firebasetable = FirebaseDatabase.getInstance().getReference().child("BarangToko"); firebasetable.addchildeventlistener(new ChildEventListener() { public void onchildadded(datasnapshot datasnapshot, String s) { Iterator i = datasnapshot.getchildren().iterator(); while (i.hasnext()) { nama = datasnapshot.getkey(); i.next(); i.next(); latitude = (String) ((DataSnapshot) i.next()).getvalue(); longitude = (String) ((DataSnapshot) i.next()).getvalue(); try { xresult = getrequestselect(" n?origins=" + Double.toString(lokasiKu.latitude) + "," + Double.toString(lokasiKu.longitude) + "&destinations=" + latitude + "," + longitude + "&key=aizasycwm7kfqs2iqimedf1a6dzpp5jmx180hz8", MenuActivity.this); parse(latitude, longitude); catch (Exception ex) { String dummy = ex.getmessage(); Toast.makeText(getApplicationContext(), "Error: " + dummy, Toast.LENGTH_LONG).show(); if (ActivityCompat.checkSelfPermission(MenuActivity.this, android.manifest.permission.access_fine_location)!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(MenuActivity.this, android.manifest.permission.access_coarse_location)!= PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onrequestpermissionsresult(int requestcode, String[] permissions, // int[] grantresults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. BC

56 return; mmap.setmylocationenabled(true); mmap.movecamera(cameraupdatefactory.newlatlngzoom(l okasiku, 15)); td.settext("selesai..."); llmap.setvisibility(view.visible); public void onchildchanged(datasnapshot datasnapshot, String s) { public void onchildremoved(datasnapshot datasnapshot) { public void onchildmoved(datasnapshot datasnapshot, String s) { public void oncancelled(databaseerror databaseerror) { ); catch (Exception e) { e.printstacktrace(); pdialog.dismiss(); public static String getrequestselect(string Url, Context ctx) { String sret = ""; HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(Url); try { HttpResponse response = client.execute(request); sret = request(response); catch (Exception ex) { Toast.makeText(ctx, "Gagal " + ex.getmessage() + ", " + ex.tostring(), Toast.LENGTH_LONG).show(); return sret; public static String request(httpresponse response) { String result = ""; try { InputStream in = response.getentity().getcontent(); BufferedReader reader = new BufferedReader( new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while ((line = reader.readline())!= null) { str.append(line + "\n"); in.close(); BD

57 result = str.tostring(); catch (Exception ex) { result = "Error"; return result; private void parse(string latitude,string longitude) throws Exception { JSONObject object_rows = null; JSONArray array_rows; object_rows = new JSONObject(xResult); array_rows = object_rows.getjsonarray("rows"); for (int i = 0; i < array_rows.length(); i++) { JSONObject object_elements = array_rows.getjsonobject(i); JSONArray array_elements = object_elements.getjsonarray("elements"); for (int ii = 0; ii < array_elements.length(); ii++) { JSONObject object_distance = array_elements.getjsonobject(ii); JSONObject distance_details = object_distance.getjsonobject("distance"); int array_value = distance_details.getint("value"); thenearestdistance = array_value; if (thenearestdistance <= limitdistance) { lokasiminimarket = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude)); Marker marker = mmap.addmarker(new MarkerOptions().position(lokasiMiniMarket).title(nama)); marker.showinfowindow(); activity_menu.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android=" xmlns:app=" xmlns:tools=" android:id="@+id/drawer_layout" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start"> <include layout="@layout/app_bar_menu" android:layout_height="match_parent" /> <android.support.design.widget.navigationview android:id="@+id/nav_view" android:layout_width="wrap_content" BE

58 android:layout_height="match_parent" android:layout_gravity="start" android:fitssystemwindows="true" /> </android.support.v4.widget.drawerlayout> OrderActivity.java package com.example.root.client; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.text.spannablestring; import android.text.style.underlinespan; import android.util.log; import android.view.view; import android.widget.adapterview; import android.widget.listview; import android.widget.textview; import com.example.root.client.adapter.productadapter; import com.example.root.client.model.product; import com.google.firebase.database.datasnapshot; import com.google.firebase.database.databaseerror; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase; import com.google.firebase.database.query; import com.google.firebase.database.valueeventlistener; import java.math.bigdecimal; import java.util.arraylist; import java.util.hashmap; import java.util.list; public class OrderActivity extends AppCompatActivity { public static String NAMA_TOKO = "Jonas"; private static final String TAG = "OrderActivity"; public static List<Product> PRODUCT_LIST = new ArrayList<Product>(); ProductAdapter productadapter; ListView lvproducts; private DatabaseReference firebasedatabase=firebasedatabase.getinstance().getreference().getroot(), firebasetable, firebasesubtable, firebasesubsubtable, firebaserecord; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_order); TextView tvviewshoppingcart = (TextView)findViewById(R.id.tvViewShoppingCart); SpannableString content = new SpannableString(getText(R.string.shopping_cart)); content.setspan(new UnderlineSpan(), 0, content.length(), 0); tvviewshoppingcart.settext(nama_toko); tvviewshoppingcart.setonclicklistener(new View.OnClickListener() { BF

59 public void onclick(view v) { Intent intent = new Intent(OrderActivity.this, ShoppingCartActivity.class); startactivity(intent); ); lvproducts = (ListView) findviewbyid(r.id.lvproducts); lvproducts.addheaderview(getlayoutinflater().inflate(r.layout.pr oduct_list_header, lvproducts, false)); firebasetable = firebasedatabase.child("barangtoko"); firebasesubtable = firebasetable.child(nama_toko); try { Query query = firebasesubtable.orderbykey(); query.addlistenerforsinglevalueevent(new ValueEventListener() { public void ondatachange(datasnapshot datasnapshot) { String idbarang=""; String namabarang=""; String hargabarang=""; String deskripsibarang=""; String fotobarang=""; productadapter = new ProductAdapter(getApplicationContext()); PRODUCT_LIST.clear(); Product PRODUCT; for(datasnapshot singlesnapshot : datasnapshot.getchildren()) { int i=0; for(datasnapshot singlesnapshot2 : singlesnapshot.getchildren()) { i++; HashMap<String, String> map = new HashMap<String, String>(); idbarang = Integer.toString(i); namabarang = singlesnapshot2.getkey().tostring(); hargabarang = singlesnapshot2.child("harga").getvalue().tostring(); PRODUCT = new Product(Integer.parseInt(idBarang), namabarang, BigDecimal.valueOf(Integer.parseInt(hargaBarang)), namabarang, "noimage"); PRODUCT_LIST.add(PRODUCT); productadapter.updateproducts(product_list); lvproducts.setadapter(productadapter); lvproducts.setonitemclicklistener(new AdapterView.OnItemClickListener() { public void onitemclick(adapterview<?> parent, View view, BG

60 int position, long id) { Product product = PRODUCT_LIST.get(position - 1); Intent intent = new Intent(OrderActivity.this, ProductActivity.class); Bundle bundle = new Bundle(); bundle.putserializable("product", product); Log.d(TAG, "View product: " + product.getname()); intent.putextras(bundle); startactivity(intent); ); public void oncancelled(databaseerror databaseerror) { ); catch (Exception ex) { activity_order.xml <RelativeLayout xmlns:android=" xmlns:tools=" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.root.client.orderactivity"> android:id="@+id/tvviewshoppingcart" android:textcolor="@color/blue" android:gravity="center" android:paddingbottom="@dimen/common_padding" android:paddingtop="@dimen/common_padding" android:text="@string/shopping_cart" android:textsize="@dimen/small_header_text_size"/> android:id="@+id/tvproductlistheader" BH

61 android:gravity="center" android:textallcaps="true" android:textstyle="bold"/> <ListView android:layout_width="fill_parent" android:layout_height="fill_parent" </RelativeLayout> activity_product.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=" android:layout_height="match_parent" android:orientation="vertical" android:layout_alignparenttop="true" android:gravity="center" android:gravity="center" android:textallcaps="true" android:textstyle="bold"/> BI

62 <ImageView android:layout_width="wrap_content" android:layout_centerhorizontal="true" android:paddingtop="5dp" android:paddingbottom="5dp"/> <LinearLayout android:layout_alignparentbottom="true" android:orientation="horizontal" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center_vertical end" <Spinner android:layout_width="0dip" android:layout_weight="0.25"/> <Button android:layout_width="0dip" android:layout_weight="0.5" android:textallcaps="true" android:textstyle="bold"/> </LinearLayout> </RelativeLayout> activity_shopping_cart.xml <RelativeLayout xmlns:android=" xmlns:tools=" android:layout_height="match_parent" BJ

63 android:gravity="center" android:textallcaps="true" android:textstyle="bold"/> <ListView android:layout_width="fill_parent" android:layout_height="fill_parent" <LinearLayout android:orientation="horizontal" android:paddingbottom="5dp" android:paddingtop="5dp" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.75" android:gravity="center_vertical end" android:textstyle="bold"/> android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center" android:text="" android:textstyle="bold"/> </LinearLayout> <LinearLayout android:layout_alignparentbottom="true" android:orientation="horizontal" android:weightsum="1"> <Button BK

64 android:layout_width="80dp" android:textallcaps="true" android:textstyle="bold" /> <Button android:layout_width="85dp" android:textallcaps="true" android:textstyle="bold" /> <Button android:layout_width="75dp" android:textallcaps="true" android:textstyle="bold" /> <Button android:layout_width="90dp" android:text="check Out" android:textallcaps="true" android:textstyle="bold" /> </LinearLayout> </RelativeLayout> app_bar_menu.xml <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_height="match_parent" tools:context="com.example.root.client.menuactivity"> <android.support.design.widget.appbarlayout <android.support.v7.widget.toolbar BL

65 android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" /> </android.support.design.widget.appbarlayout> <include /> <android.support.design.widget.floatingactionbutton android:layout_width="wrap_content" android:layout_gravity="bottom end" /> </android.support.design.widget.coordinatorlayout> cart_footer.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="horizontal" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.75" android:gravity="end center_vertical" android:textstyle="bold"/> android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center" android:text="" android:textstyle="bold"/> </LinearLayout> cart_header.java <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" BM

66 android:orientation="horizontal" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.4" android:gravity="center" android:layout_width="0dip" android:layout_weight="0.2" android:gravity="center" android:layout_width="0dip" android:layout_weight="0.15" android:gravity="center" android:layout_width="0dip" android:layout_weight="0.25" android:gravity="center" </LinearLayout> content_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" xmlns:app=" xmlns:tools=" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.root.client.menuactivity" BN

67 android:layout_width="wrap_content" android:text="loading Data..." /> <LinearLayout android:layout_height="match_parent" android:orientation="horizontal" android:visibility="invisible"> <fragment android:name="com.google.android.gms.maps.supportmapfragmen t" android:layout_height="428dp" /> </LinearLayout> </LinearLayout> nav_header_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" xmlns:app=" android:gravity="bottom" android:orientation="vertical" android:text="shopping Nearby Me" / > </LinearLayout> product_list_header.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" BO

68 android:orientation="horizontal" android:weightsum="1"> android:layout_width="0dip" android:layout_weight="0.65" android:gravity="center" android:layout_width="0dip" android:layout_weight="0.35" android:gravity="center" </LinearLayout> menu/activity_menu_drawer.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android=" <group android:checkablebehavior="single"> <item android:title="order Barang" /> <item android:title="shopping Cart" /> <item android:title="profile" /> <item android:title="logout" /> </group> </menu> <resources> <!-- values/google_maps_api.xml BP

69 TODO: Before you run your application, you need a Google Maps API key. To get one, follow this link, follow the directions and press "Create" at the end: apiid=maps_android_backend&keytype=client_side_android&r=d1:10:ea:9b:77:4 6:28:7F:A8:C6:59:EA:E3:16:CD:D4:96:A8:E3:F4%3Bcom.example.root.client You can also add your credentials to an existing key, using these values: Package name: D1:10:EA:9B:77:46:28:7F:A8:C6:59:EA:E3:16:CD:D4:96:A8:E3:F4 SHA-1 certificate fingerprint: D1:10:EA:9B:77:46:28:7F:A8:C6:59:EA:E3:16:CD:D4:96:A8:E3:F4 Alternatively, follow the directions here: Once you have your key (it starts with "AIza"), replace the "google_maps_key" string in this file. --> <string name="google_maps_key" templatemergestrategy="preserve" translatable="false"> AIzaSyCwm7KFQS2IQiMEdf1A6DzpP5JMx180hZ8 </string> </resources> values/strings.xml <resources> <string name="app_name">client</string> <string name="register">register</string> <string name="login">login</string> <string name="profile">profile</string> <string name="title_activity_menu">menu</string> <string name="navigation_drawer_open">open navigation drawer</string> <string name="navigation_drawer_close">close navigation drawer</string> <string name="action_settings">settings</string> <string name="product_list">product List</string> <string name="shopping_cart">shopping Cart</string> <string name="name">name</string> <string name="unit_price">unit Price</string> <string name="quantity">quantity</string> <string name="view">view</string> <string name="action">action</string> <string name="order">order</string> <string name="price">price</string> <string name="total_price">total Price</string> <string name="remove">remove</string> <string name="clear_cart">clear Cart</string> <string name="shop">shop</string> <string name="delete_item">delete Item</string> BQ

70 <string name="delete_item_message">are you sure you want to delete this item?</string> <string name="yes">yes</string> <string name="no">no</string> <string name="home">home</string> <string name="status">status Pesanan</string> <string name="status_message">update Status Pesanan?</string> <string name="send">terkirim</string> <string name="cancel">cancel</string> <string name="title_activity_maps">map</string> </resources> values/colors.xml <?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorprimary">#3f51b5</color> <color name="colorprimarydark">#303f9f</color> <color name="coloraccent">#ff4081</color> <color name="green">#008000</color> <color name="orange">#ff5500</color> <color name="blue">#0000ff</color> <color name="black">#00000f</color> <color name="powderblue">#b0e0e6</color> <color name="grey">#eaeaea</color> </resources> BR

71 BS

72 BT

73 BU

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

android-espresso #androidespresso

android-espresso #androidespresso android-espresso #androidespresso Table of Contents About 1 Chapter 1: Getting started with android-espresso 2 Remarks 2 Examples 2 Espresso setup instructions 2 Checking an Options Menu items (using Spoon

More information

EMBEDDED SYSTEMS PROGRAMMING Android NDK

EMBEDDED SYSTEMS PROGRAMMING Android NDK EMBEDDED SYSTEMS PROGRAMMING 2017-18 Android NDK WHAT IS THE NDK? The Android NDK is a set of cross-compilers, scripts and libraries that allows to embed native code into Android applications Native code

More information

EMBEDDED SYSTEMS PROGRAMMING Android NDK

EMBEDDED SYSTEMS PROGRAMMING Android NDK EMBEDDED SYSTEMS PROGRAMMING 2015-16 Android NDK WHAT IS THE NDK? The Android NDK is a set of cross-compilers, scripts and libraries that allows to embed native code into Android applications Native code

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Tip: Switching UIs THE PROBLEM How to switch from one UI to another Each UI is associated with a distinct class that controls it Solution shown: two UIs,

More information

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 3 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MainActivity.java File package com.example.tutorialspoint; import android.manifest;

More information

Fragment Example Create the following files and test the application on emulator or device.

Fragment Example Create the following files and test the application on emulator or device. Fragment Example Create the following files and test the application on emulator or device. File: AndroidManifest.xml

More information

APPENDIX. Application User. MainActivity.java. RegistrationActivity.java

APPENDIX. Application User. MainActivity.java. RegistrationActivity.java Application User APPENDIX MainActivity.java package com.example.finalproject; import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view;

More information

Tabel mysql. Kode di PHP. Config.php. Service.php

Tabel mysql. Kode di PHP. Config.php. Service.php Tabel mysql Kode di PHP Config.php Service.php Layout Kode di Main Activity package com.example.mini.webandroid; import android.app.progressdialog; import android.os.asynctask; import android.support.v7.app.appcompatactivity;

More information

ANDROID PROGRAMS DAY 3

ANDROID PROGRAMS DAY 3 ANDROID PROGRAMS DAY 3 //Android project to navigate from first page to second page using Intent Step 1: Create a new project Step 2: Enter necessary details while creating project. Step 3: Drag and drop

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

Lampiran Program : Res - Layout Activity_main.xml

More information

CITIZEN COP PRESENTED BY :- A CLOUD BASED CRIME REPORT APPLICATION. SOUVIK ROY - IT2014/066 AWSAF AMBAR - IT2014/067 SAYANI DUTTA - IT2014/089

CITIZEN COP PRESENTED BY :- A CLOUD BASED CRIME REPORT APPLICATION. SOUVIK ROY - IT2014/066 AWSAF AMBAR - IT2014/067 SAYANI DUTTA - IT2014/089 CITIZEN COP CITIZEN COP A CLOUD BASED CRIME REPORT APPLICATION. PRESENTED BY :- SOUVIK ROY - IT2014/066 AWSAF AMBAR - IT2014/067 SAYANI DUTTA - IT2014/089 1 CITIZEN COP A CLOUD BASED CRIME REPORTING APP

More information

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server.

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server. CSE 660 Lab 7 Submitted by: Arumugam Thendramil Pavai 1)Simple Remote Calculator Server is created using ServerSocket class of java Server.java import java.io.ioexception; import java.net.serversocket;

More information

Developing For Android

Developing For Android Wirtschaftsuniversität Wien Developing For Android From 0 to 100 on Mobile and Wearable Devices Author: Gerald Urschitz Supervisor: Ronny G. Flatscher January 7, 2016 I, Gerald Urschitz, declare that this

More information

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator. Simple Android Application for Native Calculator Aim: To develop a Simple Android Application for Native Calculator. Procedure: Creating a New project: Open Android Stdio and then click on File -> New

More information

TUTOR FINDER APP REPORT OF MAJOR PROJECT SUBMITTED FOR PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE OF MASTERS OF COMPUTER APPLICATION

TUTOR FINDER APP REPORT OF MAJOR PROJECT SUBMITTED FOR PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE OF MASTERS OF COMPUTER APPLICATION TUTOR FINDER APP REPORT OF MAJOR PROJECT SUBMITTED FOR PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE OF MASTERS OF COMPUTER APPLICATION BISHAL MANDAL REGISTRATION NO: 151170510014 of 2015-2016

More information

The Definitive Guide to Firebase

The Definitive Guide to Firebase The Definitive Guide to Firebase Build Android Apps on Google s Mobile Platform Laurence Moroney The Definitive Guide to Firebase Build Android Apps on Google s Mobile Platform Laurence Moroney The Definitive

More information

Basic GUI elements - exercises

Basic GUI elements - exercises Basic GUI elements - exercises https://developer.android.com/studio/index.html LIVE DEMO Please create a simple application, which will be used to calculate the area of basic geometric figures. To add

More information

Mobile Application Development

Mobile Application Development Mobile Application Development donation-web api { method: 'GET', path: '/api/candidates', config: CandidatesApi.find, { method: 'GET', path: '/api/candidates/{id', config: CandidatesApi.findOne, { method:

More information

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126 M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126 Submitted to: Sir Waqas Asghar MAY 23, 2017 SUBMITTED BY: REHAN ASGHAR Intent in Android What are Intent? An Intent is a messaging object you can use to request

More information

05. RecyclerView and Styles

05. RecyclerView and Styles 05. RecyclerView and Styles 08.03.2018 1 Agenda Intents Creating Lists with RecyclerView Creating Cards with CardView Application Bar Menu Styles and Themes 2 Intents 3 What is Intent? An Intent is an

More information

Practical 1.ListView example

Practical 1.ListView example Practical 1.ListView example In this example, we show you how to display a list of fruit name via ListView. Android Layout file File : res/layout/list_fruit.xml

More information

@Bind(R.id.input_ ) EditText EditText Button _loginbutton;

@Bind(R.id.input_ ) EditText EditText Button _loginbutton; package cyborg.pantaucctv; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.util.log; import android.view.view;

More information

Intents. Your first app assignment

Intents. Your first app assignment Intents Your first app assignment We will make this. Decidedly lackluster. Java Code Java Code XML XML Preview XML Java Code Java Code XML Buttons that work

More information

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 Comment and Evaluation: This lab introduces us about Android SDK and how to write a program for Android platform. The calculator is pretty easy, everything

More information

SMART VEHICLE TRACKING APPLICATION

SMART VEHICLE TRACKING APPLICATION SMART VEHICLE TRACKING APPLICATION Report submitted for the partial fulfillment of the requirements for the degree of Bachelor of Technology in Information Technology Submitted by Ritaman Baral (IT2014/008)

More information

Android UI Development

Android UI Development Android UI Development Android UI Studio Widget Layout Android UI 1 Building Applications A typical application will include: Activities - MainActivity as your entry point - Possibly other activities (corresponding

More information

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2 Workshop 1. Compare different layout by using Change Layout button (Page 1 5) Relative Layout Linear Layout (Horizontal) Linear Layout (Vertical) Frame Layout 2. Revision on basic programming skill - control

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Managing Screen Orientation ORIENTATIONS Portrait Landscape Reverse portrait Reverse landscape ON REVERSE PORTRAIT Android: all four orientations are

More information

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 2 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. Android Widgets There are given a lot of android widgets with simplified

More information

<uses-permission android:name="android.permission.internet"/>

<uses-permission android:name=android.permission.internet/> Chapter 11 Playing Video 11.1 Introduction We have discussed how to play audio in Chapter 9 using the class MediaPlayer. This class can also play video clips. In fact, the Android multimedia framework

More information

Manifest.xml. Activity.java

Manifest.xml. Activity.java Dr.K.Somasundaram Ph.D Professor Department of Computer Science and Applications Gandhigram Rural Institute, Gandhigram, Tamil Nadu-624302, India ka.somasundaram@gmail.com Manifest.xml

More information

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Diving into Android. By Jeroen Tietema. Jeroen Tietema, Diving into Android By Jeroen Tietema Jeroen Tietema, 2015 1 Requirements 4 Android SDK 1 4 Android Studio (or your IDE / editor of choice) 4 Emulator (Genymotion) or a real device. 1 See https://developer.android.com

More information

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering Getting Started Dr. Miguel A. Labrador Department of Computer Science & Engineering labrador@csee.usf.edu http://www.csee.usf.edu/~labrador 1 Goals Setting up your development environment Android Framework

More information

Android Beginners Workshop

Android Beginners Workshop Android Beginners Workshop at the M O B IL E M O N D AY m 2 d 2 D E V E L O P E R D A Y February, 23 th 2010 Sven Woltmann, AndroidPIT Sven Woltmann Studied Computer Science at the TU Ilmenau, 1994-1999

More information

Android Workshop: Model View Controller ( MVC):

Android Workshop: Model View Controller ( MVC): Android Workshop: Android Details: Android is framework that provides java programmers the ability to control different aspects of smart devices. This interaction happens through the Android SDK (Software

More information

Android - JSON Parser Tutorial

Android - JSON Parser Tutorial Android - JSON Parser Tutorial JSON stands for JavaScript Object Notation.It is an independent data exchange format and is the best alternative for XML. This chapter explains how to parse the JSON file

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

LAMPIRAN PROGRAM. public class Listdata_adiktif extends ArrayAdapter<ModelData_adiktif> {

LAMPIRAN PROGRAM. public class Listdata_adiktif extends ArrayAdapter<ModelData_adiktif> { 1 LAMPIRAN PROGRAM JAVA Listdata_adiktif.java package com.example.win.api.adapter; import android.content.context; import android.support.annotation.nonnull; import android.view.layoutinflater; import

More information

Android tips. which simplify your life

Android tips. which simplify your life Android tips which simplify your life Android Studio beta gradle build system maven-based build dependencies build variants code completion, refactoring, templates graphical template editor Gradle apply

More information

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { }

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { } Android ActionBar import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { Layout, activity.xml

More information

Mobile Software Development for Android - I397

Mobile Software Development for Android - I397 1 Mobile Software Development for Android - I397 IT COLLEGE, ANDRES KÄVER, 2015-2016 EMAIL: AKAVER@ITCOLLEGE.EE WEB: HTTP://ENOS.ITCOLLEGE.EE/~AKAVER/2015-2016/DISTANCE/ANDROID SKYPE: AKAVER Timetable

More information

API Guide for Gesture Recognition Engine. Version 2.0

API Guide for Gesture Recognition Engine. Version 2.0 API Guide for Gesture Recognition Engine Version 2.0 Table of Contents Gesture Recognition API... 3 API URI... 3 Communication Protocol... 3 Getting Started... 4 Protobuf... 4 WebSocket Library... 4 Project

More information

Android Programs Day 5

Android Programs Day 5 Android Programs Day 5 //Android Program to demonstrate the working of Options Menu. 1. Create a New Project. 2. Write the necessary codes in the MainActivity.java to create OptionMenu. 3. Add the oncreateoptionsmenu()

More information

Serious Gaming. Technical manual. This document is a collection of the code and installation process

Serious Gaming. Technical manual. This document is a collection of the code and installation process Serious Gaming Technical manual This document is a collection of the code and installation process Peter Elliott 02/04/2017 Contents Table of figures... 3 Introduction... 4 Installation instructions...

More information

LAMPIRAN PROGRAM. public class ListArrayAdapterPost extends ArrayAdapter<ModelDataPost> {

LAMPIRAN PROGRAM. public class ListArrayAdapterPost extends ArrayAdapter<ModelDataPost> { 1 LAMPIRAN PROGRAM JAVA ListArrayAdapterPost.java package com.example.win.api.adapter; import android.content.context; import android.support.annotation.nonnull; import android.view.layoutinflater; import

More information

Statistics http://www.statista.com/topics/840/smartphones/ http://www.statista.com/topics/876/android/ http://www.statista.com/statistics/271774/share-of-android-platforms-on-mobile-devices-with-android-os/

More information

PROGRAMMING APPLICATIONS DECLARATIVE GUIS

PROGRAMMING APPLICATIONS DECLARATIVE GUIS PROGRAMMING APPLICATIONS DECLARATIVE GUIS DIVING RIGHT IN Eclipse? Plugin deprecated :-( Making a new project This keeps things simple or clone or clone or clone or clone or clone or clone Try it

More information

Create Parent Activity and pass its information to Child Activity using Intents.

Create Parent Activity and pass its information to Child Activity using Intents. Create Parent Activity and pass its information to Child Activity using Intents. /* MainActivity.java */ package com.example.first; import android.os.bundle; import android.app.activity; import android.view.menu;

More information

Dynamically Create Admob Banner and Interstitial Ads

Dynamically Create Admob Banner and Interstitial Ads Dynamically Create Admob Banner and Interstitial Ads activity_main.xml file 0 0 0

More information

Arrays of Buttons. Inside Android

Arrays of Buttons. Inside Android Arrays of Buttons Inside Android The Complete Code Listing. Be careful about cutting and pasting.

More information

M.A.D Assignment # 1

M.A.D Assignment # 1 Submitted by: Rehan Asghar Roll no: BSSE (7) 15126 M.A.D Assignment # 1 Submitted to: Sir Waqas Asghar Submitted by: M. Rehan Asghar 4/25/17 Roll no: BSSE 7 15126 XML Code: Calculator Android App

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

VMware AirWatch Android SDK Technical Implementation Guide Empowering your enterprise applications with MDM capabilities using

VMware AirWatch Android SDK Technical Implementation Guide Empowering your enterprise applications with MDM capabilities using VMware AirWatch Android SDK Technical Implementation Guide Empowering your enterprise applications with MDM capabilities using the AirWatch SDK for Android AirWatch SDK v18.3 Have documentation feedback?

More information

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI Specification: Approaches UIS: APPROACHES Programmatic approach: UI elements are created inside the application code Declarative approach: UI elements are listed

More information

Android CardView Tutorial

Android CardView Tutorial Android CardView Tutorial by Kapil - Wednesday, April 13, 2016 http://www.androidtutorialpoint.com/material-design/android-cardview-tutorial/ YouTube Video We have already discussed about RecyclerView

More information

LifeStreet Media Android Publisher SDK Integration Guide

LifeStreet Media Android Publisher SDK Integration Guide LifeStreet Media Android Publisher SDK Integration Guide Version 1.12.0 Copyright 2015 Lifestreet Corporation Contents Introduction... 3 Downloading the SDK... 3 Choose type of SDK... 3 Adding the LSM

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Saving State THE PROBLEM How to save the state (of a UI, for instance) so that it survives even when the application is closed/killed The state should

More information

EMBEDDED SYSTEMS PROGRAMMING Android Services

EMBEDDED SYSTEMS PROGRAMMING Android Services EMBEDDED SYSTEMS PROGRAMMING 2016-17 Android Services APP COMPONENTS Activity: a single screen with a user interface Broadcast receiver: responds to system-wide broadcast events. No user interface Service:

More information

COMP61242: Task /04/18

COMP61242: Task /04/18 COMP61242: Task 2 1 16/04/18 1. Introduction University of Manchester School of Computer Science COMP61242: Mobile Communications Semester 2: 2017-18 Laboratory Task 2 Messaging with Android Smartphones

More information

Topics of Discussion

Topics of Discussion Reference CPET 565 Mobile Computing Systems CPET/ITC 499 Mobile Computing Fragments, ActionBar and Menus Part 3 of 5 Android Programming Concepts, by Trish Cornez and Richard Cornez, pubslihed by Jones

More information

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation 1. Location Services 1.1 GPS Location 1. Create the Android application with the following attributes. Application Name: MyLocation Project Name: Package Name: MyLocation com.example.mylocation 2. Put

More information

Android HelloWorld - Example. Tushar B. Kute,

Android HelloWorld - Example. Tushar B. Kute, Android HelloWorld - Example Tushar B. Kute, http://tusharkute.com Anatomy of Android Application Anatomy of Android Application Java This contains the.java source files for your project. By default, it

More information

Android Layout Types

Android Layout Types Android Layout Types Android Linear Layout Android LinearLayout is a view group that aligns all children in either vertically or horizontally. android:divider - This is drawable to use as a vertical divider

More information

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Software Practice 3 Before we start Today s lecture Today s Task Team organization 1 Software Practice 3 Before we start Today s lecture Today s Task Team organization Prof. Hwansoo Han T.A. Jeonghwan Park 43 2 Lecture Schedule Spring 2017 (Monday) This schedule can be changed M A R

More information

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control. A TextView displays text to the user. TextView Attributes TextView Control android:id - This is the ID which uniquely identifies the control. android:capitalize - If set, specifies that this TextView has

More information

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Shared Preferences 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran Tanveer, ITU Experts

More information

Getting Started With Android Feature Flags

Getting Started With Android Feature Flags Guide Getting Started With Android Feature Flags INTRO When it comes to getting started with feature flags (Android feature flags or just in general), you have to understand that there are degrees of feature

More information

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB) Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB) In this exercise, we will create a simple Android application that uses IBM Bluemix Cloudant NoSQL DB. The application

More information

Open Lecture Mobile Programming. Firebase Tools

Open Lecture Mobile Programming. Firebase Tools Open Lecture Mobile Programming Firebase Tools Agenda Setup Firebase Authentication Firebase Database Firebase Cloud Messaging Setting up a new Firebase project Navigate to https://console.firebase.google.com/

More information

Android JSON Parsing Tutorial

Android JSON Parsing Tutorial Android JSON Parsing Tutorial by Kapil - Thursday, May 19, 2016 http://www.androidtutorialpoint.com/networking/json-parsing-tutorial-android/ YouTube Video JSON(JavaScript Object Notation), is a language

More information

1.1 Why Foxit MobilePDF SDK is your choice Foxit MobilePDF SDK Key Features Evaluation License...

1.1 Why Foxit MobilePDF SDK is your choice Foxit MobilePDF SDK Key Features Evaluation License... TABLE OF CONTENTS 1 Introduction to Foxit MobilePDF SDK...1 1.1 Why Foxit MobilePDF SDK is your choice... 1 1.2 Foxit MobilePDF SDK... 2 1.3 Key Features... 3 1.4 Evaluation... 4 1.5 License... 4 1.6 About

More information

Press project on the left toolbar if it doesn t show an overview of the app yet.

Press project on the left toolbar if it doesn t show an overview of the app yet. #3 Setting up the permissions needed to allow the app to use GPS. Okay! Press project on the left toolbar if it doesn t show an overview of the app yet. In this project plane, we will navigate to the manifests

More information

// MainActivity.java ; Noah Spenser; Senior Design; Diabetic Breathalyzer

// MainActivity.java ; Noah Spenser; Senior Design; Diabetic Breathalyzer // MainActivity.java ; Noah Spenser; Senior Design; Diabetic Breathalyzer package com.noahspenser.seniordesign; import android.os.parcel; import android.os.parcelable; import android.support.v7.app.appcompatactivity;

More information

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE) PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE) Network Connection Web Service K Candra Brata andra.course@gmail.com Mobille App Lab 2015-2016 Network Connection http://developer.android.com/training/basics/network-ops/connecting.html

More information

Android Application Development. By : Shibaji Debnath

Android Application Development. By : Shibaji Debnath Android Application Development By : Shibaji Debnath About Me I have over 10 years experience in IT Industry. I have started my career as Java Software Developer. I worked in various multinational company.

More information

Introduction to Android Development

Introduction to Android Development Introduction to Android Development What is Android? Android is the customizable, easy to use operating system that powers more than a billion devices across the globe - from phones and tablets to watches,

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

Data Persistence. Chapter 10

Data Persistence. Chapter 10 Chapter 10 Data Persistence When applications create or capture data from user inputs, those data will only be available during the lifetime of the application. You only have access to that data as long

More information

Android Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9)

Android Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics ArrayAdapter Preferences Widgets Jonathan Diehl, Hendrik Thüs 2 ArrayAdapter Jonathan Diehl, Hendrik Thüs

More information

API Guide for Gesture Recognition Engine. Version 1.1

API Guide for Gesture Recognition Engine. Version 1.1 API Guide for Gesture Recognition Engine Version 1.1 Table of Contents Table of Contents... 2 Gesture Recognition API... 3 API URI... 3 Communication Protocol... 3 Getting Started... 4 Protobuf... 4 WebSocket

More information

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1 카메라 1.1 제어절차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1.2 관련주요메서드 setpreviewdisplay() : startpreview() : stoppreview(); onpicturetaken() : 사진을찍을때자동으로호출되며캡처한이미지가전달됨 1.3 제작철차 Step 1 프로젝트를생성한후매니페스트에퍼미션들을설정한다.

More information

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

IEMS 5722 Mobile Network Programming and Distributed Server Architecture Department of Information Engineering, CUHK MScIE 2 nd Semester, 2016/17 IEMS 5722 Mobile Network Programming and Distributed Server Architecture Lecture 12 Advanced Android Programming Lecturer: Albert

More information

1.1 Why Foxit MobilePDF SDK is your choice Foxit MobilePDF SDK Key Features Evaluation License...

1.1 Why Foxit MobilePDF SDK is your choice Foxit MobilePDF SDK Key Features Evaluation License... TABLE OF CONTENTS 1 Introduction to Foxit MobilePDF SDK...1 1.1 Why Foxit MobilePDF SDK is your choice... 1 1.2 Foxit MobilePDF SDK... 2 1.3 Key Features... 3 1.4 Evaluation... 4 1.5 License... 4 1.6 About

More information

else if(rb2.ischecked()) {

else if(rb2.ischecked()) { Problem :Toy Calculator Description:Please design an Android application that contains 2 activities: cal_main and cal_result. The following figure is a suggested layout for the cal_main activity. For the

More information

Android DP SDK Integration Guide

Android DP SDK Integration Guide Android DP SDK Integration Guide Requirements Minimum Android Version : Android 4.1 'Jelly Bean' (API level 16) instant Run Removal. (Preferences -> Instant Run -> Unlock to Enable Instant Run) Step 1.

More information

Android - Widgets Tutorial

Android - Widgets Tutorial Android - Widgets Tutorial A widget is a small gadget or control of your android application placed on the home screen. Widgets can be very handy as they allow you to put your favourite applications on

More information

1. Simple List. 1.1 Simple List using simple_list_item_1

1. Simple List. 1.1 Simple List using simple_list_item_1 1. Simple List 1.1 Simple List using simple_list_item_1 1. Create the Android application with the following attributes. Application Name: MySimpleList Project Name: Package Name: MySimpleList com.example.mysimplelist

More information

LAMPIRAN. byte bcdtodec(byte val) { return( (val/16*10) + (val%16) ); } void setup() {

LAMPIRAN. byte bcdtodec(byte val) { return( (val/16*10) + (val%16) ); } void setup() { 60 LAMPIRAN 1. Source code Arduino. #include "Wire.h" #include #include #define DS3231_I2C_ADDRESS 0x68 SoftwareSerial sim800l(11, 10); int dline[28]; byte *cacah=0; String

More information

Learn about Android Content Providers and SQLite

Learn about Android Content Providers and SQLite Tampa Bay Android Developers Group Learn about Android Content Providers and SQLite Scott A. Thisse March 20, 2012 Learn about Android Content Providers and SQLite What are they? How are they defined?

More information

Simple Currency Converter

Simple Currency Converter Simple Currency Converter Implementing a simple currency converter: USD Euro Colon (CR) Note. Naive implementation using the rates 1 Costa Rican Colon = 0.001736 U.S. dollars 1 Euro = 1.39900 U.S. dollars

More information

SDK Android Studio. 2. build.gradle. SDK moxie-client-xxx.aar libs 2.1. build.gradle. 2.4 repositories. app proguard-rules.pro

SDK Android Studio. 2. build.gradle. SDK moxie-client-xxx.aar libs 2.1. build.gradle. 2.4 repositories. app proguard-rules.pro SDK Android Studio 1. SDK SDK moxie-client-xxx.aar libs 2. build.gradle 2.1 build.gradle dependencies { compile filetree(dir: 'libs', include: ['.jar']) compile 'com.android.support:appcompat-v7:23.1.1'

More information

Q.1 Explain the dialog and also explain the Demonstrate working dialog in android.

Q.1 Explain the dialog and also explain the Demonstrate working dialog in android. Q.1 Explain the dialog and also explain the Demonstrate working dialog in android. - A dialog is a small window that prompts the user to make a decision or enter additional information. - A dialog does

More information

Our First Android Application

Our First Android Application Mobile Application Development Lecture 04 Imran Ihsan Our First Android Application Even though the HelloWorld program is trivial in introduces a wealth of new ideas the framework, activities, manifest,

More information