編輯:關於Android編程
本文實例講述了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(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程序設計有所幫助。
微信怎麼加好友 微信添加好友失敗怎麼辦
相信很多用戶都知道微信基本是怎麼加好友的了,但是部分用戶在加微信好友的時候發現,添加微信好友失敗!?不少微信網友在使用微信添加好友過程中失敗了,這是怎麼回事
Android的線程和線程池
在Java中默認情況下一個進程只有一個線程,也就是主線程,其他線程都是子線程,也叫工作線程。Android中的主線程主要處理和界面相關的事情,而子線程則往往用於執行耗時操
EasyPusher直播推送中用到的緩沖區設計和丟幀原理
問題描述我們在開發直播過程中,會需要用到直播推送端,推送端將直播的音視頻數據推送到流媒體服務器或者cdn,再由流媒體服務器/CDN進行視頻的轉發和分發,提供給客戶端進行觀
Android仿QQ列表左滑刪除操作
最近學習了如何做一個像QQ的左滑RecyclerView的item顯示選項的,主要是用到Scroller我們首先新建一個自己的RecyclerView定義好一些要用的的變