我有一个ListView
使用动态的动态ArrayAdapter
.当从微调器中选择一个名称时,该名称以及一个显示它们是男性还是女性的图标会被添加到ListView
.
一切都很好(名称正确地添加到列表中,与图标一起).但是显示性别的图标被添加到了错误的项目中ListView
.名称将添加到列表的底部,但图标将放置在列表顶部的名称处.我不知道这是否是我使用的方式,ViewHolder
但Android网站上没有文档.
// Listview inflater
inflater = (LayoutInflater) (this).getSystemService(LAYOUT_INFLATER_SERVICE);
// List Array.
mAdapter = new ArrayAdapter<String>(this, R.layout.player_simple_list,
R.id.label, mStrings) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Log.i("ANDY","View getView Called");
// A ViewHolder keeps references to children views to
// avoid unneccessary calls to findViewById() on each row.
ViewHolder holder;
if (null == convertView) {
Log.i("ANDY","Position not previously used, so inflating");
convertView = inflater.inflate(R.layout.player_simple_list, null); …
Run Code Online (Sandbox Code Playgroud) 我写了一个ping脚本地址的小脚本,然后如果ping返回成功,则将设备挂载到该地址.该文件位于Ubuntu Linux系统上的rc.local中.
如果从终端(以root用户)运行,它将运行良好,但在启动时不会从rc.local运行.我知道它正在执行,因为/tmp/buffalo_mount.log包含"从rc.local执行网络设备检测脚本".有人有任何想法吗?
注意:现在正在工作!请阅读以下注释:-)
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
ADDRESS=192.168.1.101
DATETIME="$(date)"
LOGFILE="/tmp/buffalo_mount.log"
sleep 30s
echo "Executing Network Device Detect Script From rc.local" >> …
Run Code Online (Sandbox Code Playgroud)