Android上使用jspf插件框架的方法
本文實(shí)例講述了Android上使用jspf插件框架的方法。分享給大家供大家參考。具體如下:
jspf (Java Simple Plugin Framework) 是一個(gè)插件框架,集成了很多 IoC 框架的概念在里面。
package de.jspfdemo;
import net.xeoh.plugins.base.PluginManager;
import net.xeoh.plugins.base.impl.PluginManagerFactory;
import net.xeoh.plugins.base.util.uri.ClassURI;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import de.jspfdemo.plugins.CoolPlugin;
import de.jspfdemo.plugins.impl.CoolPluginImpl;
public class JSPFDemo extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Loading and adding plugins via class uri
PluginManager pm = PluginManagerFactory.createPluginManager();
pm.addPluginsFrom(new ClassURI(CoolPluginImpl.class).toURI());
// Getting the CoolPlugin
CoolPlugin plugin = pm.getPlugin(CoolPluginImpl.class);
// Setting the text of a TextView with the help of the CoolPlugin
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText(plugin.sayHello());
}
}
希望本文所述對大家的Android程序設(shè)計(jì)有所幫助。
- 解析離線安裝Eclipse的Android ADT開發(fā)插件的具體操作(圖文)
- Android實(shí)現(xiàn)QQ搶紅包插件
- Android中微信搶紅包插件原理解析及開發(fā)思路
- 為Android Studio編寫自定義Gradle插件的教程
- 分享Android微信紅包插件
- Android搶紅包插件實(shí)現(xiàn)原理淺析
- Android桌面插件App Widget用法分析
- APP添加CNZZ統(tǒng)計(jì)插件教程 Android版添加phonegap
- Android微信自動(dòng)搶紅包插件優(yōu)化和實(shí)現(xiàn)
- Android系統(tǒng)實(shí)現(xiàn)DroidPlugin插件機(jī)制
相關(guān)文章
android Tween Animation屬性設(shè)置方法實(shí)例
在Android開發(fā)中,Animation是用來給控件制作效果的,本文介紹二種實(shí)現(xiàn)方法2013-11-11
Android利用RecyclerView實(shí)現(xiàn)列表倒計(jì)時(shí)效果
這篇文章主要為大家詳細(xì)介紹了Android利用RecyclerView實(shí)現(xiàn)列表倒計(jì)時(shí)效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-09-09
Android 滑動(dòng)監(jiān)聽的實(shí)例詳解
這篇文章主要介紹了Android 滑動(dòng)監(jiān)聽的實(shí)例詳解的相關(guān)資料,希望通過本能幫助到大家,需要的朋友可以參考下2017-09-09
Android隱藏和沉浸式虛擬按鍵NavigationBar的實(shí)現(xiàn)方法
今天小編就為大家分享一篇Android隱藏和沉浸式虛擬按鍵NavigationBar的實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-07-07
Android中使用Intent在Activity之間傳遞對象(使用Serializable或者Parcelable)的
這篇文章主要介紹了 Android中使用Intent在Activity之間傳遞對象(使用Serializable或者Parcelable)的方法的相關(guān)資料,需要的朋友可以參考下2016-01-01
Android登錄注冊功能 數(shù)據(jù)庫SQLite驗(yàn)證
這篇文章主要為大家詳細(xì)介紹了Android登錄注冊功能,數(shù)據(jù)庫SQLite驗(yàn)證,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-10-10

