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();
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();
}
it's function for example, how im using alert.. call : alert("message");
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();
}
hope im right understand u.
精彩评论