手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >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开发之软键盘用法实例分析

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

Android 退出程序的若干方法总结

Android-使用AIDL进程间通信

Android 读写文件方法汇总

android 动态控制状态栏显示和隐藏的方法实例

Android应用程序的调试

Android三种播放视频的方式

Android 获取进程内存使用情况方法

精品推荐
分类导航