一个简单的基于注解的Android库,用于生成onActivityForResult处理程序

网友投稿 597 2022-10-29

一个简单的基于注解的Android库,用于生成onActivityForResult处理程序

一个简单的基于注解的Android库,用于生成onActivityForResult处理程序

Aftermath

Aftermath handles the consequences of your startActivityForResult calls.

// Make some call to startActivityForResultpublic void startPicker(View view) { Intent pickContactIntent = new Intent(Intent.ACTION_PICK, Uri.parse("content://contacts")); pickContactIntent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST);}@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) { Aftermath.onActivityResult(this, requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);}@OnActivityResult(PICK_CONTACT_REQUEST)public void onContactPicked(int resultCode, Intent data) { // TODO: handle the result of your intent}

Setup

buildscript { repositories { jcenter() // Also available in maven central } dependencies { classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' }}apply plugin: 'com.neenbedankt.android-apt'dependencies { apt 'org.michaelevans:aftermath-processor:0.3.1' compile 'org.michaelevans:aftermath:0.3.1'}

License

Copyright 2015 Michael EvansLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:k8s-kubernetes-configmap
下一篇:Zookeeper+Kafka集群搭建
相关文章

 发表评论

暂时没有评论,来抢沙发吧~