zoukankan      html  css  js  c++  java
  • Activity生命周期

    Log类对错误的排查:示例代码

    private final static String TAG = "MainActivity"; //宏定义
    Log.i(TAG,"MainActivity---->OnCreate");    //排错
    View Code

     Activity 的save保存

    宏定义:    private static final String CONTENT = "content";
    OnCreate中添加EditText的判断条件:
    txt=(EditText)findViewById(R.id.txt);
            if(null==savedInstanceState && savedInstanceState.containsKey(CONTENT)) {
                    txt.setText(savedInstanceState.getString(CONTENT));
            }
    
    创建Save函数:
        @Override
        protected void onSaveInstanceState(Bundle outState) {
            // TODO Auto-generated method stub
            super.onSaveInstanceState(outState);
            String content=txt.getText().toString();
            outState.putString(CONTENT, content);
        }
    这部分代码在虚拟机上运行会出现错误,需要一个具有android系统的手机。
    View Code

    android:theme显示连接

    android:theme="@android:style/Theme.Dialog"//显示为对话框
    android:theme="@android:style/Theme.NoTitleBar"//没有标题
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:theme="@android:style/Theme.Light.NoTitleBar"
    android:theme="@android:style/Theme.Wallpaper" 
    android:theme="@android:style/Theme.Translucent"//背景透明化
    android:theme="@android:style/Theme.Panel" //无标题背景透明化
    View Code

    在AndroidManifest.xml中新建的Activity中加入如下的一句话可以把其变成对话框的形式.

     android:theme="@android:style/Theme.Dialog"
    View Code
  • 相关阅读:
    关于ADO.NET连接池
    The Cost of GUIDs as Primary Keys
    数据库反规范设计
    如何快速的呈现我们的网页(转)
    小议数据库主键选取策略(转自吕震宇老师博文)
    javascript 单元测试 (Jsunit应用) 转
    sqlserver版本降级方法
    算术运算表达式正则及分析
    sql STUFF用法
    Flex DashBoard功能
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3115323.html
Copyright © 2011-2022 走看看