# Finder **Repository Path**: ShareKnowledge/Finder ## Basic Information - **Project Name**: Finder - **Description**: 这是我的第一个Android注解框架,通过反射实现。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-03-30 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Finder #### Introduction 这是我的第一个Android注解框架,次框架的目的是减少`findViewById`带来的枯燥的工作。此框架的实现机制是通过反射来实现的。 #### 使用框架 ```java public class MainActivity extends AppCompatActivity { @BindView(R.id.btn1) Button btn1; @BindView(R.id.btn2) Button btn2; private Unbinder mUnbinder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //进行绑定操作 mUnbinder = Finder.bind(this); btn1.setText("Hello world!"); } /** * 可以绑定多个View */ @ClickEvent({R.id.btn1, R.id.btn2}) public void btn1Click(View view) { Toast.makeText(this, "My id is: " + view.getId(), Toast.LENGTH_SHORT).show(); } /** * 进行解绑操作,释放资源 */ @Override protected void onDestroy() { mUnbinder.unbind(); super.onDestroy(); } } ```