手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >Android上使用jspf插件框架的方法
Android上使用jspf插件框架的方法
摘要:本文实例讲述了Android上使用jspf插件框架的方法。分享给大家供大家参考。具体如下:jspf(JavaSimplePluginFram...

本文实例讲述了Android上使用jspf插件框架的方法。分享给大家供大家参考。具体如下:

jspf (Java Simple Plugin Framework) 是一个插件框架,集成了很多 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(yout.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程序设计有所帮助。

【Android上使用jspf插件框架的方法】相关文章:

android 修改代码怎样编译

Android-使用AIDL进程间通信

Android中3种图片压缩处理方法

Android 通用型手电筒代码

Android绑定添加了注解的控件,及其事件方法

Android中在控件上显示倒计时

Android Studio使用教程图文详解

android打开应用所在的市场页面进行评分操作的方法

Android实现长按back键退出应用程序的方法

Android中实现动态切换组件背景的操作

精品推荐
分类导航