final ViewGroup layout_order = (ViewGroup) LayoutInflater.from(
Menus.this).inflate(R.layout.ex, null);
AlertDialog.Builder builder_order = new AlertDialog.Builder(
Menus.this);
builder_order.setView(layout_order);
Enumeration e = orderDataHT.keys();
Object obj;
obj = e.nextElement();
String quantity = (String) obj;
String instruction = (String) orderDataHT.get(obj);
System.out.println(quantity);
System.out.println(instruction);
setContentView(R.layout.ex);
builder_order.setView(layout_order);
TextView tv = (TextView) findViewById(R.id.quantitytext1);
tv.setText(quantity, BufferType.NORMAL);
TextView tv1 = (TextView) findViewById(R.id.instructiontext);
tv1.setText(instruction, BufferType.NORMAL);
builder_order.show();
答案 0 :(得分:0)
public void alert(String message)
{
new AlertDialog.Builder(this)
.setMessage(message)
.setTitle("Warning!!!")
.setCancelable(true)
.setNeutralButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton){}
})
.show();
}
它的功能,例如,我如何使用alert .. call:alert(“message”);
答案 1 :(得分:0)
Dialog ds;
public void exampleDialog()
{
sd = new Dialog(yourClassName.this);
mainW = new LinearLayout(getApplicationContext());
mainW.setOrientation(LinearLayout.VERTICAL);
// in mainW u can add buttons, TextViews, and other what u want .
sd.setContentView(mainW);
sd.setTitle("Download ");
//here code what you want for example
TextView text = new TextView(getApplicationContext());
text.setText("some text");
mainW.addView(text);
sd.setCancelable(true);
sd.show();
}
希望我正确理解你。