Belajardengan.com merupakan domain blog lama dari delajardengan.blogspot.com. Mohon kritik dan sarannya untuk perkembangan blog ini.
email: blog.tkx.pnp@gmail.com

coba Belajar Adroid (12)

♠ Posted by Unknown in
 source code  11

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="1">
    <AnalogClock android:id="@+id/analogClock1" android:layout_width="wrap_content" android:layout_height="wrap_content"></AnalogClock>
</LinearLayout>

coba Belajar Adroid (11)

♠ Posted by Unknown in
source code  11

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="1">
    <EditText android:layout_width="fill_parent" android:id="@+id/editText1" android:layout_height="wrap_content" android:text="Blilii" android:gravity="right">
        <requestFocus></requestFocus>
    </EditText>
    <EditText android:layout_width="fill_parent" android:id="@+id/editText2" android:layout_height="wrap_content" android:layout_weight="0.33" android:text="Coba Grafity" android:gravity="center_vertical|center"></EditText>
    <EditText android:layout_width="fill_parent" android:id="@+id/editText3" android:layout_height="wrap_content" android:inputType="textPersonName" android:text="Balala"></EditText>
</LinearLayout>


import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;

public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
Button btn;
@Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
}
}

hasilnya:

coba Belajar Adroid (10)

♠ Posted by Unknown in


file *.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">

<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:text="red" android:gravity="center_horizontal"
android:background="#aa0000" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="green" android:gravity="center_horizontal"
android:background="#00aa00" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="blue" android:gravity="center_horizontal"
android:background="#0000aa" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="yellow" android:gravity="center_horizontal"
android:background="#aaaa00" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="1" />
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:text="red" android:gravity="center_horizontal"
android:background="#aa0000" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="green" android:gravity="center_horizontal"
android:background="#00aa00" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="blue" android:gravity="center_horizontal"
android:background="#0000aa" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_weight="1" />
<TextView android:text="yellow" android:gravity="center_horizontal"
android:background="#aaaa00" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_weight="1" />
</LinearLayout>
</LinearLayout>


file Tes2sanActivity.java 



import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;


public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
Button btn;
@Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
}
}



hasilnya :

coba Belajar Adroid (9)

♠ Posted by Unknown in

file *.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Contoh penggunaan dari AlertDialog JARC-SEAMOLEC"
    />
</LinearLayout>


Tes2sanActivity.java 
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;

public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
      Button btn;
      @Override
    public void onCreate(Bundle savedInstanceState) {
           
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final CharSequence[] warna = {"Sirah", "Kuniang", "Ijau" , "Biru"};

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Pilih warna kesukaan mu ");
        builder.setItems(warna, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                Toast.makeText(getApplicationContext(), warna[item], Toast.LENGTH_SHORT).show();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
      }    
}

Hasilnya:



coba Belajar Adroid (8)

♠ Posted by Unknown in


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <ToggleButton android:text="ToggleButton" android:id="@+id/toggleButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textOn="On" android:textOff="Off"></ToggleButton>
</LinearLayout>

hasilnya :

coba Belajar Adroid (7)

♠ Posted by Unknown in

source code  7

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <ToggleButton android:text="ToggleButton" android:id="@+id/toggleButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textOn="On" android:textOff="Off"></ToggleButton>
    
</LinearLayout>




hasilnya:

coba Belajar Adroid (6)

♠ Posted by Unknown in

source code  6


Tes2sanActivity.java

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageButton;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageButton;

public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
Button btn;
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btn.setImageResource(R.drawable.icon);
        ImageButton btn = (ImageButton)this.findViewById(R.id.imageButton1);

}
}

main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<ImageButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/imageButton1" android:src="@drawable/icon"></ImageButton>
</LinearLayout>



hasilnya:


coba Belajar Adroid (5)

♠ Posted by Unknown in
source code  5


Tes2sanActivity.java


import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Tes2sanActivity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
Button btn;
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         btn= (Button)this.findViewById(R.id.button1);
    }
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v==btn){
finish();
}
}
}

main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>


hasilnya:




coba Belajar Adroid (4)

♠ Posted by Unknown in
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;

public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LinearLayout ly=new LinearLayout(this);
        TextView txt=new TextView(this);
        txt.setText("Nama kota di Indonesia : ");
        ly.addView(txt);
        MultiAutoCompleteTextView mactv = new MultiAutoCompleteTextView(this);
        ArrayAdapter<String> aa2 = new ArrayAdapter<String>(this,
        android.R.layout.simple_dropdown_item_1line,new String[] {"Cimahi", "Bandung", "Jakarta", "Surabaya", "Bali", "Semarang","Balikpapan"});
        mactv.setAdapter(aa2);
        mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
        mactv.setWidth(500);
        mactv.setHeight(50);
        ly.addView(mactv);
        setContentView(ly);
    }
}

coba Belajar Adroid (3)

♠ Posted by Unknown in
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Tes2sanActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LinearLayout ly=new LinearLayout(this);
        TextView txt=new TextView(this);
        txt.setText("Nama kota di Indonesia : ");
        ly.addView(txt);
        AutoCompleteTextView actv = new AutoCompleteTextView(this);
        ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
  android.R.layout.simple_dropdown_item_1line,new String[] {"Cimahi", "Bandung", "Jakarta", "Surabaya", "Bali", "Semarang","Balikpapan"});
        actv.setAdapter(aa);
        actv.setWidth(500);
        actv.setHeight(50);
        ly.addView(actv);
        setContentView(ly);

    }
}