コード例 #1
0
 protected internal override void onCreate(android.os.Bundle savedInstanceState)
 {
     base.onCreate(savedInstanceState);
     android.os.Bundle extras = getIntent().getExtras();
     if (extras == null)
     {
         finish();
         return;
     }
     mNumDeletes = extras.getLong("numDeletes");
     mAccount    = (android.accounts.Account)extras.getParcelable("account");
     mAuthority  = extras.getString("authority");
     mProvider   = extras.getString("provider");
     // the order of these must match up with the constants for position used in onItemClick
     java.lang.CharSequence[] options = new java.lang.CharSequence[] { getResources().
                                                                       getText([email protected][email protected]_really_delete), getResources().getText(
                                                                           [email protected][email protected]_undo_deletes), getResources().getText([email protected]
                                                                                                                                                  [email protected]_do_nothing) };
     android.widget.ListAdapter adapter = new android.widget.ArrayAdapter <java.lang.CharSequence
                                                                           >(this, android.R.layout.simple_list_item_1, android.R.id.text1, options);
     android.widget.ListView listView = new android.widget.ListView(this);
     listView.setAdapter(adapter);
     listView.setItemsCanFocus(true);
     listView.setOnItemClickListener(this);
     android.widget.TextView textView = new android.widget.TextView(this);
     java.lang.CharSequence  tooManyDeletesDescFormat = getResources().getText([email protected]
                                                                               [email protected]_too_many_deletes_desc);
     textView.setText(java.lang.CharSequenceProxy.Wrap(string.Format(tooManyDeletesDescFormat
                                                                     .ToString(), mNumDeletes, mProvider, mAccount.name)));
     android.widget.LinearLayout ll = new android.widget.LinearLayout(this);
     ll.setOrientation(android.widget.LinearLayout.VERTICAL);
     android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams
                                                       (android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams
                                                       .WRAP_CONTENT, 0);
     ll.addView(textView, lp);
     ll.addView(listView, lp);
     // TODO: consider displaying the icon of the account type
     //        AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes();
     //        for (AuthenticatorDescription desc : descs) {
     //            if (desc.type.equals(mAccount.type)) {
     //                try {
     //                    final Context authContext = createPackageContext(desc.packageName, 0);
     //                    ImageView imageView = new ImageView(this);
     //                    imageView.setImageDrawable(authContext.getResources().getDrawable(desc.iconId));
     //                    ll.addView(imageView, lp);
     //                } catch (PackageManager.NameNotFoundException e) {
     //                }
     //                break;
     //            }
     //        }
     setContentView(ll);
 }