1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| package denis.android;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ApplicationPortfolioActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.btn_menu_principal).setOnClickListener(this);
findViewById(R.id.btn_menu_web_id).setOnClickListener(this);
findViewById(R.id.btn_menu_graphisme_id).setOnClickListener(this);
findViewById(R.id.btn_menu_mobile_id).setOnClickListener(this);
findViewById(R.id.btn_menu_architecture_id).setOnClickListener(this);
}
public void onClick(View v) {
switch(v.getId()) {
case R.id.btn_menu_principal:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
ListView menuList = new ListView(this);
String[] stringArray = new String[] { "Mon site web", "Mon CV", "Me contacter" };
ArrayAdapter<String> modeAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, stringArray);
menuList.setAdapter(modeAdapter);
builder.setView(menuList);
final Dialog dialog = builder.create();
dialog.show();
break;
}
}
} |
Partager