Friday, December 8, 2017

Google maps Multi Direction

Tags



//multi direction 3 titik


//multi direction 4 . jika 5 atau lebih silahkan di tambahkan /kordinatnya

https://www.google.com/maps/dir/ -6.353504, 106.832786/ -6.360772, 106.831722/ -6.302564, 106.840649/ -6.372470, 106.833271

Tuesday, August 29, 2017

Android Code Time And Date (DatePicker) Otomatis

Tags

         Calendar cal = Calendar.getInstance();

        int jam = cal.get(Calendar.HOUR);
       
int menit= cal.get(Calendar.MINUTE);
       
int detik= cal.get(Calendar.SECOND);

       
int tgl= cal.get(Calendar.DATE);
       
int bln= cal.get(Calendar.MONTH)+1;
       
int thn= cal.get(Calendar.YEAR);

        String bul=
"Januari";
       
if(bln==1){bul="Januari";}
       
else if(bln==2){bul="Februari";}
       
else if(bln==3){bul="Maret";}
       
else if(bln==4){bul="April";}
        
else if(bln==5){bul="Mei";}
       
else if(bln==6){bul="Juni";}
       
else if(bln==7){bul="Juli";}
       
else if(bln==8){bul="Agustus";}
       
else if(bln==9){bul="September";}
       
else if(bln==10){bul="Oktober";}
       
else if(bln==11){bul="November";}
       
else if(bln==12){bul="Desember";}

        String stgl=String.valueOf(tgl)+
" "+bul+" "+String.valueOf(thn);
        String sjam=String.valueOf(jam)+
":"+String.valueOf(menit)+":"+String.valueOf(detik);
       
//+++++tanggal otomastis   +++++

Monday, August 28, 2017

Android Login Session

Tags

Monday, August 21, 2017

Scrol view layout

Tags
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
   
xmlns:android="http://schemas.android.com/apk/res/android"
   
xmlns:app="http://schemas.android.com/apk/res-auto"
   
xmlns:tools="http://schemas.android.com/tools"
   
android:layout_width="match_parent"
   
android:layout_height="match_parent"
   
android:background="@drawable/ic_bgr"
   
tools:context="com.claps.root.claps.MainActivity">
    <
ScrollView
       
android:layout_width="fill_parent"
       
android:layout_height="wrap_content"
       
tools:layout_editor_absoluteX="1dp"
       
tools:layout_editor_absoluteY="0dp">
        <
TableLayout
           
android:id="@+id/TableLayout01"
           
android:layout_width="fill_parent"
            
android:layout_height="fill_parent"
           
android:layout_marginTop="10px"
           
android:stretchColumns="1,1">
            <
TextView
               
android:id="@+id/txtMarquee"
               
android:layout_width="wrap_content"
                
android:layout_height="wrap_content"
               
android:text="tes"
               
android:textSize="14sp"
               
android:typeface="sans"
               
android:textColor="#000000"
               
android:background="#cccccc"
                
android:singleLine="true"
               
android:ellipsize="marquee"
               
android:marqueeRepeatLimit="marquee_forever">
            </
TextView>
            <
TableRow
               
android:id="@+id/TableRow01"
               
android:layout_margin="20px">

                <
ImageView
                   
android:id="@+id/btnAdmin"
                   
android:layout_width="200px"
                   
android:layout_height="180px"
                   
android:src="@drawable/ic_profil" />
                <
ImageView
                   
android:id="@+id/btnLes"
                   
android:layout_width="200px"
                   
android:layout_height="180px"
                   
android:src="@drawable/login" />

            </
TableRow>
            <
TableRow
               
android:id="@+id/TableRow03"
               
android:layout_margin="20px">
                <
ImageView
                   
android:id="@+id/btnBantuan"
                   
android:layout_width="200px"
                   
android:layout_height="180px"
                   
android:src="@drawable/ic_bantuan" />
                <
ImageView
                   
android:id="@+id/btnKeluar"
                   
android:layout_width="200px"
                   
android:layout_height="180px"
                   
android:src="@drawable/ic_keluar" />
            </
TableRow>
        </
TableLayout>
    </
ScrollView>
</
LinearLayout>
    ////////////////////////////////////////////////////////////////////
    menu_utama.xml
    <?
xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bgrn"
tools:context="com.claps.root.claps.MainActivity">
<
ScrollView
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
   
tools:layout_editor_absoluteX="1dp"
   
tools:layout_editor_absoluteY="0dp">

    <
TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
       
android:id="@+id/TableLayout01"
       
android:layout_width="fill_parent"
       
android:layout_height="fill_parent"
       
android:layout_marginTop="10px"
       
android:stretchColumns="1,1">
        <
TextView
           
android:id="@+id/txtMarquee"
           
android:layout_width="wrap_content"
           
android:layout_height="wrap_content"
           
android:text="tes"
           
android:textSize="14sp"
           
android:typeface="sans"
           
android:textColor="#000000"
           
android:background="#cccccc"
           
android:singleLine="true"
           
android:ellipsize="marquee"
           
android:marqueeRepeatLimit="marquee_forever">
        </
TextView>
        <
TableRow
           
android:id="@+id/TableRow01"
           
android:layout_margin="20px">
            <
ImageView
               
android:id="@+id/btnProfil"
               
android:layout_width="200px"
               
android:layout_height="180px"
               
android:src="@drawable/profil4" />
            <
ImageView
               
android:id="@+id/btnLes"
               
android:layout_width="200px"
               
android:layout_height="180px"
               
android:src="@drawable/ic_les" />
        </
TableRow>
        <
TableRow
           
android:id="@+id/TableRow02"
           
android:layout_margin="20px">
            <
ImageView
               
android:id="@+id/btnMap"
               
android:layout_width="200px"
               
android:layout_height="180px"
               
android:src="@drawable/i_map" />
            <
ImageView
               
android:id="@+id/btnCari"
                
android:layout_width="200px"
               
android:layout_height="180px"
               
android:src="@drawable/i_cari" />
        </
TableRow>
        <
TableRow
           
android:id="@+id/TableRow03"
           
android:layout_margin="20px">
            <
ImageView
               
android:id="@+id/btnBantuan"
               
android:layout_width="200px"
               
android:layout_height="180px"
               
android:src="@drawable/i_bantuan" />

            <
ImageView
               
android:id="@+id/btnKeluar"
               
android:layout_width="200px"
               
android:layout_height="180px"
               
android:src="@drawable/i_keluar" />

        </
TableRow>
        <
TableRow
           
android:id="@+id/TableRow04"
            
android:layout_margin="20px">
        </
TableRow>
    </
TableLayout>
</
ScrollView>
</
LinearLayout>

 

Monday, August 14, 2017

register xml android

Tags
package com.example.stoli;
import android.os.Bundle;
import android.app.Activity;
import driver.Utils;
import driver.XMLParser;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;

public class Buat_Akun extends Activity {


    RadioButton
radIndihome, radSpeedy, radTelepon;
    RadioGroup
radg;
    EditText
txtno_idlayanan,txtnama_pelanggan,txtno_hp,txtpassword, txtemail;
    String
no_idlayanan,nama_pelanggan,no_hp,email,password,kategory;
   
@Override
   
protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
        setContentView(R.layout.buat_akun);

       
radg=(RadioGroup) findViewById(R.id.myRadioGroup);
        radIndihome=(RadioButton) findViewById(R.id.radIndihome);
        radSpeedy=(RadioButton) findViewById(R.id.radSpeedy);
        radTelepon=(RadioButton) findViewById(R.id.radTelepon);

//        radg.addView(radLaki);
//        radg.addView(radPerempuan);
//        radLaki.setChecked(true);

//     if(jk.eq("Laki-laki")){
//       radLaki.setChecked(true);
//     }
//     else{
//     radLaki.setChecked(true);
//     }

       
txtno_idlayanan=(EditText)findViewById(R.id.ino_idlayanan);
        txtnama_pelanggan=(EditText)findViewById(R.id.inama_pelanggan);
        txtno_hp=(EditText)findViewById(R.id.ino_hp);
        txtemail=(EditText)findViewById(R.id.iemail);
        txtpassword=(EditText)findViewById(R.id.ipassword);


        txtno_idlayanan.setText(no_idlayanan);
        txtnama_pelanggan.setText(nama_pelanggan);
        txtno_hp.setText(no_hp);
        txtemail.setText(email);
        txtpassword.setText(password);

        Button  btnReg=(Button)findViewById(R.id.btnDaftar);
        btnReg.setOnClickListener(
new View.OnClickListener() {
           
public void onClick(View arg0) {
                no_idlayanan=txtno_idlayanan.getText().toString().trim();
                nama_pelanggan=txtnama_pelanggan.getText().toString().trim();
                no_hp=txtno_hp.getText().toString().trim();
                email=txtemail.getText().toString().trim();
               
//kategory="Indihome";

               
if(radSpeedy.isChecked()){
                    kategory=
"Indihome";
                }
               
else if(radSpeedy.isChecked()){
                    kategory=
"Speedy";
                }
               
else {
                    kategory=
"Telepon";
                }

                password=txtpassword.getText().toString().trim();

               
if(no_idlayanan.length()<1){lengkapi("no_idlayanan");}
               
else if(nama_pelanggan.length()<1){lengkapi("nama_pelanggan");}
               
else if(no_hp.length()<1){lengkapi("no_hp");}
               
else if(email.length()<1){lengkapi("email");}
               
else if(password.length()<1){lengkapi("password");}
               
//else if(kategory.length()<1){lengkapi("kategory");}
               
else{
                    no_idlayanan=no_idlayanan.replaceAll(
" ", "_");
                    kategory=kategory.replaceAll(
" ", "_");
                    nama_pelanggan=nama_pelanggan.replaceAll(
" ", "_");
                    no_hp=no_hp.replaceAll(
" ", "_");
                    email=email.replaceAll(
" ", "_");
                    password=password.replaceAll(
" ", "_");

                    Utils ip=
new Utils();
                    String myip=ip.getIP();
                    String URL = myip+
"android/buat_akun.php?no_idlayanan="+no_idlayanan+"&kategory="+kategory+"&nama_pelanggan="+nama_pelanggan+"&no_hp="+no_hp+"&email="+email+"&password="+password+"&ket=ok";
                    Log.v(
"sql",URL);
                    XMLParser parser =
new XMLParser();
                    String xml = parser.getXmlFromUrl(URL);
                   
if(xml.indexOf("sukses")>=0){sukses(no_idlayanan,"Registrasi");}
                   
else{gagal(no_idlayanan);}
                }

            }});
        Button  btnBack=(Button)findViewById(R.id.btnBack);
        btnBack.setOnClickListener(
new View.OnClickListener() {
            
public void onClick(View arg0) {
                finish();

            }});



    }

   
public void lengkapi(String item){
       
new AlertDialog.Builder(this)
                .setTitle(
"Lengkapi Data")
                .setMessage(
"Silakan lengkapi data "+item)
                .setNeutralButton(
"OK", new DialogInterface.OnClickListener() {
                   
public void onClick(DialogInterface dlg, int sumthin) {
                    }})
                .show();
    }

   
public void sukses(String item,String ex){
       
new AlertDialog.Builder(this)
                .setTitle(
"Sukses "+ex)
                .setMessage(ex+
" data "+item+" Berhasil")
                .setNeutralButton(
"OK", new DialogInterface.OnClickListener() {
                   
public void onClick(DialogInterface dlg, int sumthin) {
                        finish();
                    }})
                .show();
    }

   
public void gagal(String item){
       
new AlertDialog.Builder(this)
                .setTitle(
"Gagal Registrasi")
                .setMessage(
"Registrasi data "+item+" Gagal")
                .setNeutralButton(
"OK", new DialogInterface.OnClickListener() {
                   
public void onClick(DialogInterface dlg, int sumthin) {
                    }})
                .show();
    }


   
public boolean onKeyDown(int keyCode, KeyEvent event) {
       
if (keyCode == KeyEvent.KEYCODE_BACK) {
            finish();
           
return true;
        }
       
return super.onKeyDown(keyCode, event);
    }

}