小编Ten*_*eve的帖子

无法解析@ style/Theme.Sherlock

我正在尝试使用Actionbar Sherlock 4,定位sdk 15和min sdk 8.按照使用网站上提供的说明和此处发布的精彩视频:http://www.youtube.com/watch?v = avcp6eD_X2k

我还在遇到问题.当我尝试将android:theme ="@ style/Theme.Sherlock"添加到我的清单文件时,我收到错误:

找不到与给定名称匹配的资源(在'theme'处,值为'@ style/Theme.Sherlock').

我已将动作栏Sherlock库项目包含到我的项目中,并且导入语句在那里,并没有出现任何错误,我已经

扩展SherlockActivity实现ActionBar.TabListener

就像在演示代码和文档中一样但是,eclipse仍然给了我这个错误.有什么想法吗?

android actionbarsherlock

16
推荐指数
2
解决办法
2万
查看次数

在运行时配置HikariCP + Hibernate + GuicePersist(JPA)

我有一个使用GuicePersist,Hibernate和HikariCP的java8桌面应用程序与Postgres DB进行通信.我已成功使用此META-INF/persistence.xml让我的应用程序向数据库发送/接收数据:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
    <!-- A JPA Persistence Unit -->
    <persistence-unit name="myJPAunit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>com.123fakestreet.bogus.tomb.impl.postgres.model.movies</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <!-- SQL stuff -->
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect" />
            <property name="hibernate.show_sql" value="false" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.hbm2ddl.auto" value="validate" />

            <!-- hikari CP -->
            <property name="hibernate.connection.provider_class" value="org.hibernate.hikaricp.internal.HikariCPConnectionProvider" />
            <property name="hibernate.hikari.minimumIdle" value="20" />
            <property name="hibernate.hikari.maximumPoolSize" value="100" />
            <property name="hibernate.hikari.idleTimeout" value="30000" />
            <property name="hibernate.hikari.dataSourceClassName" value="org.postgresql.ds.PGSimpleDataSource" />
            <property name="hibernate.hikari.dataSource.url" value="jdbc:postgresql://192.168.100.75:5432/mpDb" />
            <property name="hibernate.hikari.username" value="cowboy" />
            <property name="hibernate.hikari.password" value="bebop" />

            <!-- Disable the …
Run Code Online (Sandbox Code Playgroud)

java hibernate jpa guice-persist hikaricp

6
推荐指数
1
解决办法
2696
查看次数

Android BaseAdapter处理空ArrayList

我正在尝试使用基本适配器使用ArrayList>填充ListView.ArrayList由数据库填充,数据库可能没有条目,因此可能是空的ArrayList,例如第一次启动应用程序时.当ArrayList为空时,我收到一个非去脚本"java.lang.RuntimeException:无法启动活动ComponentInfo ... java.lang.NullPointerException".

我的onCreate方法如下所示:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.samples_list_layout);
    mContext = getApplicationContext();
    lv = getListView();
    list = myDatabase.getInstance(mContext).getAllSamples();
    sa = new SamplesAdapter(this, list);
    lv.setAdapter(sa);
    registerForContextMenu(lv);
}
Run Code Online (Sandbox Code Playgroud)

设置lv.setAdapter(null)将使应用程序显示我已设置的空列表视图.但是,当我把它留给BaseAdapter时,我得到了错误.我遵循了2个Android List8.java和List14.java示例,并且两种方式都给出了相同的结果.我的BaseAdapter类看起来像这样:

public class SamplesAdapter extends BaseAdapter {

private static final String SAMPLE_NAME_COL = "name";

private static final String SAMPLE_HOST_COL = "host";

private static final String SAMPLE_ICON_COL = "icon";

private static final String SAMPLE_MODIFIED_STAMP_COL = "moddate";

private Context mContext;
private ArrayList<HashMap<String, String>> samples = new ArrayList<HashMap<String, String>>();

public SamplesAdapter(Context c, ArrayList<HashMap<String, …
Run Code Online (Sandbox Code Playgroud)

java android listview baseadapter

2
推荐指数
1
解决办法
2751
查看次数