zoukankan      html  css  js  c++  java
  • android人人网登陆例子研究

    eoe上有源码,点击一个自定义图片按钮控件,弹出自定义的一个dialog..内含输入框可登陆.
    自定的图片按钮:ConnectButton.java
    对话框:RenrenDialog.java
     
    传值
    Bundle bundle=new Bundle();bundle.putString("store", "数据来自Activity1");Intent mIntent=new Intent();
    mIntent.putExtras(bundle);
    获取
    Bundle extras=getIntent().getExtras();
    if(extras!=null){data=extras.getString("store");}
     
    Dialog
    //根据不同事件弹出不同的窗口
    //showDialog(dialog)时调用这里
    @Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG1: return buildDialog1(ActivityMain.this); case DIALOG2: return buildDialog2(ActivityMain.this); case DIALOG3: return buildDialog3(ActivityMain.this); case DIALOG4: return buildDialog4(ActivityMain.this); } return null; }
    protected void onPrepareDialog(int id, Dialog dialog){ if(id==DIALOG1){ setTitle("测试"); }
    //这里很奇怪,好像是窗口打开时运行的东西,判断某个为dialog1时改变标题(嗯,)
    } Button button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(DIALOG1); } }); Button buttons2 = (Button) findViewById(R.id.buttons2); buttons2.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(DIALOG2); } }); //。。其他button private Dialog buildDialog1(Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.alert_dialog_icon); builder.setTitle(R.string.alert_dialog_two_buttons_title); builder.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { setTitle("点击了对话框上的确定按钮"); } }); builder.setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { setTitle("点击了对话框上的取消按钮"); } }); return builder.create(); }//弹出窗口信息

    private Dialog buildDialog3(Context context) {
      LayoutInflater inflater = LayoutInflater.from(this);
      final View textEntryView = inflater.inflate(//在dialog内放入实例化的view,定义所需的内容,如登录信息等
        R.layout.alert_dialog_text_entry, null);
      AlertDialog.Builder builder = new AlertDialog.Builder(context);
      builder.setIcon(R.drawable.alert_dialog_icon);
      builder.setTitle(R.string.alert_dialog_text_entry);
      builder.setView(textEntryView);
      builder.setPositiveButton(R.string.alert_dialog_ok,
        new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int whichButton) {
          setTitle("点击了对话框上的确定按钮");
         }
        });
      builder.setNegativeButton(R.string.alert_dialog_cancel,
        new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int whichButton) {
          setTitle("点击了对话框上的取消按钮");
         }
        });
      return builder.create();
     }

     private Dialog buildDialog4(Context context) {
      ProgressDialog dialog = new ProgressDialog(context);//Loading 之前都是alertDialog,这里是ProgressDialog
      dialog.setTitle("正在下载歌曲");
      dialog.setMessage("请稍候……");
      return  dialog;
     }

     
    待续
  • 相关阅读:
    【公告】对乐逍遥和王者之剑利用破解程序插入刷流量广告处理结果
    Thunder7.2.13.3884 JayXon
    免费获取半年 Bitdefender Total Security 2014
    WIN8.1 PRO RTM VOL.2013.09.18
    免费一年MAP2014+6个月免费MIS2014
    大蜘蛛9.0正式版
    腾讯控股涉足商业银行 微信或成先头兵
    植物大战僵尸2:奇妙时空之旅[官方安卓简体中文高清版]有内含....
    苹果iPhone 5C和5S发布后,消费者如何选择?
    pandas中DataFrame操作(一)
  • 原文地址:https://www.cnblogs.com/zwl12549/p/2020289.html
Copyright © 2011-2022 走看看