久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='7VtsH'></small><noframes id='7VtsH'>

    <bdo id='7VtsH'></bdo><ul id='7VtsH'></ul>
  • <legend id='7VtsH'><style id='7VtsH'><dir id='7VtsH'><q id='7VtsH'></q></dir></style></legend>
  • <i id='7VtsH'><tr id='7VtsH'><dt id='7VtsH'><q id='7VtsH'><span id='7VtsH'><b id='7VtsH'><form id='7VtsH'><ins id='7VtsH'></ins><ul id='7VtsH'></ul><sub id='7VtsH'></sub></form><legend id='7VtsH'></legend><bdo id='7VtsH'><pre id='7VtsH'><center id='7VtsH'></center></pre></bdo></b><th id='7VtsH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7VtsH'><tfoot id='7VtsH'></tfoot><dl id='7VtsH'><fieldset id='7VtsH'></fieldset></dl></div>

      <tfoot id='7VtsH'></tfoot>

        如何將自定義列表視圖設置為對話框

        how to set a custom list view into a dialog box(如何將自定義列表視圖設置為對話框)
        <i id='V0gz3'><tr id='V0gz3'><dt id='V0gz3'><q id='V0gz3'><span id='V0gz3'><b id='V0gz3'><form id='V0gz3'><ins id='V0gz3'></ins><ul id='V0gz3'></ul><sub id='V0gz3'></sub></form><legend id='V0gz3'></legend><bdo id='V0gz3'><pre id='V0gz3'><center id='V0gz3'></center></pre></bdo></b><th id='V0gz3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='V0gz3'><tfoot id='V0gz3'></tfoot><dl id='V0gz3'><fieldset id='V0gz3'></fieldset></dl></div>

        <small id='V0gz3'></small><noframes id='V0gz3'>

        • <bdo id='V0gz3'></bdo><ul id='V0gz3'></ul>

            1. <legend id='V0gz3'><style id='V0gz3'><dir id='V0gz3'><q id='V0gz3'></q></dir></style></legend>

                    <tbody id='V0gz3'></tbody>
                1. <tfoot id='V0gz3'></tfoot>
                  本文介紹了如何將自定義列表視圖設置為對話框的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在開發一個應用程序,該應用程序從 Web 服務獲取一些數據并顯示在列表視圖中.我已經實現了一個由 BaseAdapter 擴展的自定義適配器.在 getView() 方法中,我也對原始數據進行了充氣.這些都工作得很好.

                  I am developing a application which fetches some data from a web service and displays in a list view. I have implemented a custom adapter which is extended by BaseAdapter. In the getView() method I inflate the raw also.. Those are working perfectly.

                  我的問題是我已經實現了代碼以在用戶單擊列表項時顯示一個對話框,但現在我想顯示另一個對話框,其中包含一個自定義列表(單擊是"按鈕時).我還想在該列表視圖中顯示一些數據.[我有一個 ArrayList 填充了我想要的數據].我正在我的適配器類中編寫代碼.誰能給我一些想法怎么做?

                  My problem is I have implemented code to show a dialog box when user click on an list item, but now I want to show another dialog box which has a custom list inside it (when Yes button clicked). I also want to show some data in that listview. [I have a ArrayList filled with the data that I wanted] . I'm writing the code inside my adapter class. Can anyone give me some idea how to do it ?

                  這是我的代碼:

                  public class NewsRowAdapter extends BaseAdapter  {
                  
                  
                  private Context mContext;
                  private Activity activity;
                  private static LayoutInflater inflater=null;
                  private ArrayList<HashMap<String, String>> data;
                  int resource;
                      //String response;
                      //Context context;
                      //Initialize adapter
                      public NewsRowAdapter(Context ctx,Activity act, int resource,ArrayList<HashMap<String, String>> d) {
                          super();
                          this.resource=resource;
                          this.data = d;
                          this.activity = act;
                          this.mContext = ctx;
                          inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                  
                      }
                  
                  
                      public void dialogshow(final String Date,final String Start,final String End){
                  
                          AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity);
                          alertDialogBuilder.setTitle("Confirm your Action!");
                  
                          // set dialog message
                          alertDialogBuilder
                              .setMessage("Click yes to exit!")
                              .setCancelable(false)
                              .setPositiveButton("Yes",new DialogInterface.OnClickListener() {
                                  public void onClick(DialogInterface dialog,int id) {
                                      // if this button is clicked, close
                                      // current activity
                                      //MainActivity.this.finish();
                  
                                  //  Toast.makeText(mContext, "Yes clicked", Toast.LENGTH_LONG).show();
                  
                                      //check similer records
                  
                                  //  ShortList sh = new ShortList();
                  
                                  //  ArrayList<HashMap<String, String>> duplicateList; 
                                  //  duplicateList=sh.getDuplicated(Date, Start, End);
                  
                  
                                      //if duplicates > 1 then show the popup list
                              //      if(duplicateList.size()>1){
                                      AlertDialog.Builder alertDialogBuilder2 = new AlertDialog.Builder(activity);
                  
                                      LayoutInflater infl = activity.getLayoutInflater();
                  
                  
                  
                  
                                      //View vi = infl.inflate(id, root)
                  
                  
                  
                  
                  
                                      alertDialogBuilder2.setView(infl.inflate(R.layout.dialog_row, null))
                                      .setPositiveButton("Accept", new DialogInterface.OnClickListener() {
                  
                                                  @Override
                                                  public void onClick(DialogInterface dialog, int which) {
                                                      // TODO Auto-generated method stub
                                                      Toast.makeText(mContext, "Accepted", Toast.LENGTH_LONG).show();
                                                  }
                                              })
                                              .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                  
                                                  @Override
                                                  public void onClick(DialogInterface dialog, int which) {
                                                      // TODO Auto-generated method stub
                                                      dialog.dismiss();
                                                  }
                                              });
                  
                                      alertDialogBuilder2.show();
                  
                  
                                  //  }
                  
                  
                  
                                  }
                                })
                                .setNegativeButton("No",new DialogInterface.OnClickListener() {
                                      public void onClick(DialogInterface dialog,int id) {
                                          // if this button is clicked, just close
                                          // the dialog box and do nothing
                                          dialog.cancel();
                                      }
                                  });
                          alertDialogBuilder.show();
                  
                      }
                  
                  
                  
                  @Override
                  public View getView(final int position, View convertView, final ViewGroup parent) {
                  
                  
                      View vi = convertView;
                      if(convertView==null)
                          vi = inflater.inflate(R.layout.row,null);
                  
                  
                          final TextView firstname = (TextView) vi.findViewById(R.id.fname);
                          final TextView lastname = (TextView) vi.findViewById(R.id.lname);
                          final TextView startTime = (TextView) vi.findViewById(R.id.stime);
                          final TextView endTime = (TextView) vi.findViewById(R.id.etime);
                          final TextView date = (TextView) vi.findViewById(R.id.blank);
                          final ImageView img = (ImageView) vi.findViewById(R.id.list_image);
                  
                  
                          HashMap<String, String> song = new HashMap<String, String>();
                          song =data.get(position);
                  
                          firstname.setText(song.get(MainActivity.TAG_PROP_FNAME));
                          lastname.setText(song.get(MainActivity.TAG_PROP_LNAME));
                          startTime.setText(song.get(MainActivity.TAG_STIME));
                          endTime.setText(song.get(MainActivity.TAG_ETIME));
                          date.setText(song.get(MainActivity.TAG_DATE));
                          //imageLoader.DisplayImage(song.get(CustomizedListView.KEY_THUMB_URL), img);
                  
                          Button accept = (Button) vi.findViewById(R.id.button1);
                          accept.setOnClickListener(new OnClickListener() {
                  
                              @Override
                              public void onClick(View v) {
                                  // TODO Auto-generated method stub
                                  final int x = (int) getItemId(position);
                                  /*Intent zoom=new Intent(mContext, Profile.class);
                                  zoom.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
                                  zoom.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                  mContext.startActivity(zoom);*/
                  
                                  // get the intent from the hashmap check if there is similar date and time.
                                  //then store them in a list or array.
                  
                                  String getDate = (String) date.getText();
                                  String getStartTime = startTime.getText().toString();
                                  String getEndTime = endTime.getText().toString();
                  
                                  dialogshow(getDate,getStartTime,getEndTime);
                              }
                      });
                  
                  
                          vi.setOnClickListener(new OnClickListener() {
                  
                              @Override
                              public void onClick(View v) {
                                  // TODO Auto-generated method stub
                  
                                  String getFname = firstname.getText().toString();
                                  Toast.makeText(parent.getContext(), "view clicked: "+getFname , Toast.LENGTH_SHORT).show();
                  
                                  //get the id of the view
                                  //check the id of the request
                                  //call the web service acording to the id
                  
                                  Intent zoom=new Intent(parent.getContext(), Profile.class);   
                                  parent.getContext().startActivity(zoom);
                  
                  
                  
                              }
                          });
                  
                          return vi;
                  
                  
                  }
                  

                  推薦答案

                  你在正確的軌道上,這是我用來動態顯示一個包含項目列表的對話框.

                  You are on the right track, Here is what i used to dynamically display a Dialog with a list of items in it.

                  這里提出了一個類似的問題作為參考:Android 自定義列表對話框

                  For reference a similar Question was asked here : Android custom list dialog

                      //String[] list_data; Preloaded with a String array
                  
                      final CharSequence[] items = new CharSequence[list_data.length];
                  
                              for (int i = 0; i < list_data.length; i++) {
                                 items[i] = list_data[i];
                              }
                  
                      AlertDialog.Builder builder = new AlertDialog.Builder(this);
                      builder.setTitle("Select the data you want");
                      builder.setItems(items, new DialogInterface.OnClickListener() {
                  
                          @Override
                          public void onClick(DialogInterface dialog, int which) {
                              //Get the id of the item
                              diag_callback();
                  
                          }
                  
                      });
                  
                      AlertDialog alert = builder.create();
                      alert.show();
                  
                  }
                  
                  public void diag_callback() {
                      //Do someting when the user has made his selection
                  }
                  

                  希望這能解決您的問題.

                  Hope this sorts out your problem.

                  這篇關于如何將自定義列表視圖設置為對話框的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                  Get current location during app launch(在應用啟動期間獲取當前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)
                    <bdo id='XdSaT'></bdo><ul id='XdSaT'></ul>
                      • <i id='XdSaT'><tr id='XdSaT'><dt id='XdSaT'><q id='XdSaT'><span id='XdSaT'><b id='XdSaT'><form id='XdSaT'><ins id='XdSaT'></ins><ul id='XdSaT'></ul><sub id='XdSaT'></sub></form><legend id='XdSaT'></legend><bdo id='XdSaT'><pre id='XdSaT'><center id='XdSaT'></center></pre></bdo></b><th id='XdSaT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XdSaT'><tfoot id='XdSaT'></tfoot><dl id='XdSaT'><fieldset id='XdSaT'></fieldset></dl></div>
                          <tbody id='XdSaT'></tbody>

                          <legend id='XdSaT'><style id='XdSaT'><dir id='XdSaT'><q id='XdSaT'></q></dir></style></legend>

                        • <small id='XdSaT'></small><noframes id='XdSaT'>

                            <tfoot id='XdSaT'></tfoot>
                            主站蜘蛛池模板: 国产成人麻豆免费观看 | 免费看国产精品视频 | 久久精品国产99国产精品 | 国产一区二区三区精品久久久 | 欧美日韩一区在线 | 亚州中文字幕 | 久久一区二区视频 | 国产激情视频 | 欧美黄色片 | 九九精品在线 | 九九av| 欧美黑人激情 | av在线免费网 | 亚洲一区在线播放 | 国产一区二区精品在线观看 | 精品中文字幕一区 | 国产精品综合色区在线观看 | 99亚洲精品视频 | 国产成人午夜高潮毛片 | 精品国产乱码久久久久久牛牛 | 久久精品网| 亚洲欧美一区二区三区国产精品 | 成人在线免费网站 | 久久五月婷 | 欧美日韩一区二区三区在线观看 | 超碰伊人 | 九色在线观看 | 精品视频国产 | 中文字幕在线一区 | 不卡一区二区在线观看 | 久久精品国产一区 | 日韩精品一区二区三区中文在线 | 午夜精品久久 | 亚洲黄色一级毛片 | 羞羞视频在线观看网站 | 精品一区电影 | 欧美在线高清 | 91激情视频| 久久av在线播放 | 国产视频二区 | 免费一区二区在线观看 |