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

C++ | contoh soal array

♠ Posted by Unknown in
/*
mis nilai random array 4x5
nilai A
a b c d e
f  g h  i  j
k l m n o
p q r s t

C++ | contoh mencari nilai genab, ganjil, dan modus pada array

♠ Posted by Unknown in
/* data berjumlah 50
berisi nilai random atau acak dari -10 s/d 10
cari nilai genap (1-10)
cari nilai ganjil (1-10)
cari nilai yang paling banyak muncul
 */
#include<iostream>
using namespace std;

int main(){
int iData[50],jlGe=0,jlGa=0;// diasumsikan jumlah array 50 dan diisi random

Tiga hari di Serang

♠ Posted by Unknown in
Kamis sore itu saya mendapatkan sebuah pesan singkat, isinya sangat mengagetkan saya. Karena besoknya jam 5 pagi saya dan teman saya Rahmi Wulan S mendapat kesempatan pergi bersama 2 staf IT Seamolec ke Serang Banten, tepatnya di SMAN1 Cinangka. Setiba di SMAN1 Cinangka kami langsung disambut oleh kepala sekolahnya, dan kami langsung dipersilahkan masuk kesebuah ruang kelas dimana disana kami telah ditunggu oleh 60 lebih kepala sekolah yang datang dari berbagai sekolah yang ada di Kabupaten Serang.  Dan pertemuan dengan kepala-kepala sekolah SMA-SMK

Aplikasi Android Client Server Sederhana (Menu Makanan Indonesia)

♠ Posted by Unknown in
A.       Pengenalan
Aplikasi  Resep Makanan Indonesia merupa aplikasi pencarian resep menu makanan Indonesia berbasis klien server. Berikut skema aplikasinya:


B.       StrukturDatabase
Database
Nama database : ‘mm’
C.       Struktur Program

A.       Sourcecode dan tampilan Aplikasi
1.      MmActivity.java

Belajar Adroid - ListView

♠ Posted by Unknown in
ListView

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

import android.content.Context;
import android.graphics.Typeface;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;

public class GggActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ExpandableListView list = new ExpandableListView(this);
        list.setGroupIndicator(null);
        list.setChildIndicator(null);
        String[] titles = { "Klik ini 1","Klik ini 2","Klik ini 3"};
        String[] fruits = {"1-1","1-2"};
        String[] veggies = {"2-1","2-2","2-3"};
        String[] meats = {"3-1","3-2"};
        String[][] contents = {fruits,veggies,meats};
        SimplerExpandableListAdapter adapter = new SimplerExpandableListAdapter(this,
            titles, contents);

        list.setAdapter(adapter);
        setContentView(list);

    }
}

class SimplerExpandableListAdapter extends BaseExpandableListAdapter {
 private Context mContext;
 private String[][] mContents;
 private String[] mTitles;
 
 public SimplerExpandableListAdapter(Context context, String[] titles, String[][] contents) {
   super();
   if(titles.length != contents.length) {
     throw new IllegalArgumentException("Titles and Contents must be the same size.");
   }
   
   mContext = context;
   mContents = contents;
   mTitles = titles;
 }
 @Override
 public String getChild(int groupPosition, int childPosition) {
   return mContents[groupPosition][childPosition];
 }
 @Override
 public long getChildId(int groupPosition, int childPosition) {
   return 0;
 }
 @Override
 public View getChildView(int groupPosition, int childPosition,
     boolean isLastChild, View convertView, ViewGroup parent) {
   TextView row = (TextView)convertView;
   if(row == null) {
     row = new TextView(mContext);
   }
   row.setText(mContents[groupPosition][childPosition]);
   return row;
 }
 @Override
 public int getChildrenCount(int groupPosition) {
   return mContents[groupPosition].length;
 }
 @Override
 public String[] getGroup(int groupPosition) {
   return mContents[groupPosition];
 }
 @Override
 public int getGroupCount() {
   return mContents.length;
 }
 @Override
 public long getGroupId(int groupPosition) {
   return 0;
 }
 @Override
 public View getGroupView(int groupPosition, boolean isExpanded,
     View convertView, ViewGroup parent) {
   TextView row = (TextView)convertView;
   if(row == null) {
     row = new TextView(mContext);
   }
   row.setTypeface(Typeface.DEFAULT_BOLD);
   row.setText(mTitles[groupPosition]);
   return row;
 }

 @Override
 public boolean hasStableIds() {
   return false;
 }

 @Override
 public boolean isChildSelectable(int groupPosition, int childPosition) {
   return true;
 }

}

hasilnya:




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);
    }
}