2011-03-07 34 views
0
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

嘗試添加更多的細節,你會得到更快的答案!什麼是實際的錯誤?你的logcat說什麼? – Blundell 2011-03-07 08:54:19

回答

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

它的功能,例如,如何即時通訊使用警報..呼叫:警報(「消息」);

+0

我從一個警報對話框中讀取數據,我將數據存儲在散列表中,我想要檢索用戶在另一個對話框中輸入的數據。 – sam 2011-03-07 09:57:04

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

希望我能理解你。