企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
2.1 目录结构 ![](https://img.kancloud.cn/69/d0/69d0f0890a2e248c514f705f97d0b4ed_342x279.jpg) 2.2 源码 **activity_main.xml** ``` <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="htt p://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="click" android:text="小喵叫一声"/></RelativeLayout> ``` **MainActivity.class** ``` package com.aitsuki.bugfix; import android.os.Bundle;import android.support.v7.app.AppCompatActivity; import android.view.View;import android.widget.Toast;import com.aitsuki. bugfix.animal.Cat; public class MainActivity extends AppCompatActivity { private Cat mCat; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mCat = new Cat(); } public void click(View view) { Toast.makeText(this, mCat.say(),Toast.LENGTH_SHORT).show(); }} ``` **Cat.class** ``` package com.aitsuki.bugfix.animal; /** * Created by AItsuki on 2016/3/14. */public class Cat { public String say() { return "汪汪汪!"; }} ``` 2.3 运行结果 ![](https://img.kancloud.cn/80/45/8045bdd6990b8dab6870bfb1e9d7d1ad_360x553.jpg) 假设这是我们公司的开发项目,刚刚上线就发现了严重bug,猫会狗叫。想修复bug,让用户再立刻更新一次显然很不友好,此时热补丁修复技术就有用了。