AC_SUBST不扩展变量(AC_SUBST does not expand variable)
在Autotools项目中,我试图生成我的.conf文件的一部分。 该程序需要从
$(pkgdatadir)
读取,但我知道该变量仅在Makefile.in
设置,所以我改为替换datadir
和PACKAGE
。configure.ac:
AC_PREREQ([2.69]) AC_INIT([foo], [1.0.0], [me@foo.com]) AC_CONFIG_SRCDIR([foo.c]) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) AC_SUBST(datadir) AC_SUBST(PACKAGE) AC_CONFIG_FILES(foo.conf) AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_MKDIR_P AC_CONFIG_FILES([Makefile]) AC_OUTPUT
foo.conf.in:
Dir = @datadir@/@PACKAGE@
由此产生的foo.conf:
Dir = ${prefix}/share/foo
我想autoconf在替换时评估
${prefix}
,我不知道如何实现这一点。In an Autotools project I am trying to generate parts of my .conf file. The program needs to read from
$(pkgdatadir)
, but I know that that variable is only set inMakefile.in
, so I instead substituteddatadir
andPACKAGE
.configure.ac:
AC_PREREQ([2.69]) AC_INIT([foo], [1.0.0], [me@foo.com]) AC_CONFIG_SRCDIR([foo.c]) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) AC_SUBST(datadir) AC_SUBST(PACKAGE) AC_CONFIG_FILES(foo.conf) AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_MKDIR_P AC_CONFIG_FILES([Makefile]) AC_OUTPUT
foo.conf.in:
Dir = @datadir@/@PACKAGE@
The resulting foo.conf:
Dir = ${prefix}/share/foo
I would like autoconf to evaluate the
${prefix}
when substituting, and I don't know how to make that happen.
原文:https://stackoverflow.com/questions/30897170
最满意答案
我想,你正在从IntentService更新GridView,其中Context是空的。 尝试从下面的IntentService中获取上下文,并让我知道。
public void update(Context cont, ArrayList<Article> data){ mArticleAdapter = new ArticleAdapter(cont, R.layout.aricle_grid_element,data); mGridView.setAdapter(mArticleAdapter); }
I think, you are updating GridView from IntentService where Context is null. Try to pull context from IntentService like below and let me know.
public void update(Context cont, ArrayList<Article> data){ mArticleAdapter = new ArticleAdapter(cont, R.layout.aricle_grid_element,data); mGridView.setAdapter(mArticleAdapter); }
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
片段中的GridView崩溃了(GridView in a fragment crashed)[2021-07-14]
您的GridView R.id.gridview似乎不在布局R.layout.activity_main 。 将其添加到布局中,或者如果要使用片段,则加载片段, GridView应位于Fragment2布局R.layout.fragment2 。 解决方案1 如果您选择使用Fragment2则从MainActivity删除以下代码并在Fragment2添加 GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdap ... -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
我想,你正在从IntentService更新GridView,其中Context是空的。 尝试从下面的IntentService中获取上下文,并让我知道。 public void update(Context cont, ArrayList
data){ mArticleAdapter = new ArticleAdapter(cont, R.layout.aricle_grid_element,data); mGridView.setAdapter(mArticleAda ... -
修改项目标题并在适配器上调用notifyDataSetChanged() 编辑: ArrayList
- itemList = new ArrayList
- (); itemList.add(new Item("title 1")); itemList.add(new Item("title 2")); YourCustomAdapter adapter = new YourCustomAdapter(getActivity(), R.layout.your_layout_item, it ...
- itemList = new ArrayList
-
更新GridView(Updating a GridView)[2022-10-11]
您需要通知适配器数据元素已更改。 试试这个update()方法: public void update(int id, int player){ grid[id] = R.drawable.ic_notifications_black_24dp; notifyDataSetChanged(); } Ok, I've found the problem, I was setting the grid in the getView(int position, View convertView, ... -
更新gridview中的所有行(update all rows in gridview)[2022-03-28]
GridView并不是一次编辑所有行。 要做到这一点,实际上并非如此直截了当。 如果您想这样做,请查看以下文章: 真实世界GridView:批量编辑 我建议不要使用GridView并使用Repeater来显示数据。 然后,当您要编辑时,使用其他页面(或具有不同Repeater的面板)来显示编辑控件。 使用此解决方案,您的代码将更易于维护。 您没有解释为什么需要一次编辑所有行,因此上述解决方案之一应该可以正常工作。 A GridView is not really ment to edit all rows ... -
我建议如下, 为网格视图中的所有按钮使用通用的onClick列表器 在getView函数中为所有butons设置标记。 适配器。 使用标记Object来决定从onClick侦听器触发的意图。 我希望它有帮助.. Once again I am answering my own question: http://bottlecapnet.blogspot.com/2012/01/android-buttons-have-no-place-inside.html I will just have to styl ...
-
动态更新gridview。(Dynamically update gridview.)[2021-08-13]
你在使用ASP.NET吗? 如果是,Grid无法知道数据源的更新。 如果你想这样做,你可以尝试使用AJAX并定期让一些后台工作人员拉数据。 但这对带宽非常不敏感。 如果它不是为性能而设计的,这可能会导致糟糕的客户反馈。 Are you using ASP.NET? If yes, there is no way by which Grid can know about the updates on the data source. If you want to do this, you can try to ... -
方法3 最后我使用了中间解决方案(经常发生)。 “空拇指”在GridView中具有相同的视图。 因此,当它向ArraList添加一个空Thumb时,它还会在其他列表中添加,以保持Empty Thumb在ArrayList中的位置。 接下来,当“全拇指”到达时,我得到这个新位置列表的第一个位置,然后我在ArrayList中用空拇指替换空拇指在这个位置,最后我从位置列表中删除这个位置。 Approach 3 Finally I have used a middle solution (as often happ ...