giovedì 22 aprile 2010

giovedì 15 aprile 2010

lezione 15-04-10

insert into ristorante values (1,"calimero","via pulcino nero n34")

insert into ristorante values (2,"osteria del Ghiottone", "via del Sorcio morto 22")

select * from ristorante

select * from ristorante where id=1;

update ristorante set indirizzo="via del sorcio vivo 22" where id=2;

delete from ristorante where id=1;

sqlite3

mercoledì 14 aprile 2010

Cellulare Android

Ristorante.java

package apt.tutorial;
public class Ristorante{
String nome="";
String indirizzo="";
public String getNome(){
return nome;
}
public void setNome(String n){
nome=n;
}
public String getIndirizzo(){
return indirizzo;
}
public void setIndirizzo(String i){
indirizzo=i;
}
}

main.xlm


android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name:"
/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>

android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address:"
/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>

LunchList.java

package apt.tutorial;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class LunchList extends Activity {
Ristorante r=new Ristorante();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button save=(Button)findViewById(R.id.save);
save.setOnClickListener(onSave);
}
private View.OnClickListener onSave=new View.OnClickListener() {
public void onClick(View v) {
EditText name=(EditText)findViewById(R.id.nome);
EditText address=(EditText)findViewById(R.id.indirizzo);
r.setNome(name.getText().toString());
r.setIndirizzo(address.getText().toString());
}
};
}