android中常用的匿名内部类的写法
2016-03-20 11:25
399 查看
<span style="font-size:18px;">package com.zhh; /** * * android中常用的匿名内部类的写法 * */ public class MyNiMing { public static void main(String[] args) { method1(new MyInterface() { @Override public void method2() { System.out.println("我是zhh"); // 执行结果:我是zhh } }); } /** * 写一个方法,参数传接口对象 */ public static void method1(MyInterface myInterface){ myInterface.method2(); } } /** * 一个接口 */ interface MyInterface{ public void method2(); } </span>
相关文章推荐
- ADB运行框架原理解析
- FragmentTabhost的使用
- android 源码下载
- android控件框架介绍
- Android学习第三周_自定义控件、Fragment和Handler
- Android获取屏幕宽度与高度
- android:gravity与android:layout_gravity的区别
- android:layout_weight新认识
- android震动器类Vibrator
- 小白学习android
- 【Android】Android应用安装失败及无法打开
- android学习笔记——服务、内容提供器、广播接收器、应用程序上下文
- android动画基础
- Android 设计模式 之 单例模式
- android之startActivityForResult
- Android开发入门
- Qt:Windows10 64bit VMware虚拟机环境,基于Qt 5.6 MinGW,静态编译版本和Android环境
- Android调用系统照相机返回intent为空原因分析
- Android应用的全透明效果--Activity及Dialog的全透明
- Remote Code Execution as System User on Android 5 Samsung Devices abusing WifiCredService (Hotspot 2