小编She*_*ouk的帖子

如何从多选列表视图中获取所选项目

我正在使用数组适配器,并且这是添加字符串s的数组列表,列表是多选,如何获取列表项的值被点击?

my_contacts_list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice,conts_list);
  my_contacts_list.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)

我试图这样做,

SparseBooleanArray positions = my_contacts_list.getCheckedItemPositions();
  int size=positions.size();
  int i=0;
  while(i <= size){
   conts_list.get(positions.get(i));
   i++;
  }
Run Code Online (Sandbox Code Playgroud)

但是position.get(i)是一个数组列表,那么如何检索所选项呢?

android android-listview

47
推荐指数
3
解决办法
8万
查看次数

我有一个1024x1024 png我想把它分成64x64(256个相等的部分)

我有一个1024x1024 png我想把它分成64x64(256个相等的部分)

我找到了一个可以做到这一点的程序,但它不是免费的,它被称为"拆分和平铺"

我想找到一个免费的方式来做到这一点.

image-manipulation

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

VB.Net 替代 C# 下划线(丢弃)

在 C# 中,我可以这样做:

_ = Bla();

我可以在 VB.Net 中做到这一点吗?

我认为答案是否定的,但我只是想确定一下。

vb.net

5
推荐指数
1
解决办法
889
查看次数

HttpURLConnection c = URL.openConnection(); c.setRequestProperty()不起作用

这里的代码是一个普通的Java应用程序,而不是一个Android应用程序,它设计用于将带有YOUR_REGISTRATION_STRING的C2DM消息作为开发人员用auth_key发送,问题描述如下

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;


public class C2DMSendMessage {
    private final static String AUTH = "authentication";

    private static final String UPDATE_CLIENT_AUTH = "Update-Client-Auth";

    public static final String PARAM_REGISTRATION_ID = "registration_id";

    public static final String PARAM_DELAY_WHILE_IDLE = "delay_while_idle";

    public static final String PARAM_COLLAPSE_KEY = "collapse_key";

    private static final String UTF8 = "UTF-8";

    // Registration is currently hardcoded
    private final static String YOUR_REGISTRATION_STRING = "APA91bGf8gkFMn_sBP_hosSAiqUmmLwOdIqVSQKbbqXv2WSADQ51gbixInAGUk1U_vDIcz7izVaq6tvu8KXGsiQ7BIKy_7f04id00SUms8h3YGxbsKd6Jjg";

    public …
Run Code Online (Sandbox Code Playgroud)

java httpurlconnection android-c2dm

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

Symfony2 Doctrine2-通过doctrine:mapping:import从现有数据库生成一对多注释

我想通过使用Doctrine工具进行逆向工程从现有数据库生成实体

/*
 * SET FOREIGN_KEY_CHECKS=0;
  -- ----------------------------
  -- Table structure for `country`
  -- ----------------------------
  DROP TABLE IF EXISTS `country`;
  CREATE TABLE `country` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8;


  -- ----------------------------
  -- Table structure for `provider`
  -- ----------------------------
  DROP TABLE IF EXISTS `provider`;
  CREATE TABLE `provider` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT …
Run Code Online (Sandbox Code Playgroud)

php database orm symfony doctrine-orm

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

如何将AppDelegate从Swift转换回Objective C?

我有一个我创建的项目作为新的Swift项目,我需要将它的AppDelegate转换回Objective C后我改变它很多,所以它不像创建新项目那么容易

注意:我们需要这个,因为我们有一个项目需要快速完成,没有时间去探索swift.

objective-c ios appdelegate swift xcode6

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

如何在Android中的ViewPager中实现ExpandableList?

如何在Android中的ViewPager中实现ExpandableList?

这是google提供的一个简单的1文件ExpandableList

/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF …
Run Code Online (Sandbox Code Playgroud)

android

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

从boost线程在主线程上运行函数并将参数传递给该函数

我有一些代码在一个boost线程中运行,它修改了主线程处理的东西,这个东西不起作用,这是有意义的.

在android上我会有Handler一个消息队列,它将在主线程上执行我的代码,我可以将任何我想要的参数传递给这个处理程序.

我想用提升来做同样的事情

所以在我的主线程上我做了以下事情:

boost::thread workerThread(boost::bind(&SomeClass::pollService, this));
Run Code Online (Sandbox Code Playgroud)

我的pollService方法:

SomeClass::pollService()
{
     //get some stuff from a web service
     //parse the json response
     //NEEDED part: call a function to be executed on the main thread and hand it some functions
}
Run Code Online (Sandbox Code Playgroud)

PS我看了很多io_service.post例子,我仍然不知道怎么做,而且我也读了一个说要用的答案,asio strand但我也无法理解.

有人可以为我愚蠢吗?请不要写那么抽象的东西,我不明白,我没有经验.谢谢

boost boost-bind boost-thread boost-asio

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

试图让proguard工作,但总是失败

请不要将其作为副本关闭!

我已经尝试升级到proguard 4.11

我已经尝试添加我使用的库和我使用的库使用的库(这有意义:O)

我尝试过添加-keep class com.google.**和保留其他课程

我试过了 -dontwarn fi.foyt.*

以下是相关文件:

ProGuard的-project.txt

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more …
Run Code Online (Sandbox Code Playgroud)

android proguard

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

如何截断不为空的SQL Server表?

DECLARE @sql VARCHAR(MAX)

SELECT @sql = X.[text()]
FROM
    (SELECT 'truncate table '+ t.TABLE_NAME + ';' AS [text()]
     FROM sysindexes i, INFORMATION_SCHEMA.TABLES t
     WHERE t.TABLE_NAME = object_name(i.id)
       AND t.TABLE_TYPE = 'BASE TABLE' 
       AND t.TABLE_NAME NOT IN ('Test')
     GROUP BY t.TABLE_SCHEMA, t.TABLE_NAME
     HAVING MAX(i.rows) > 0
     FOR XML PATH ('')) X

exec(@sql)
Run Code Online (Sandbox Code Playgroud)

我正在尝试在这个问题中创建类似于上述的脚本,但是我得到了:

消息8155,级别16,状态2,行12
没有为“ X”的列1指定列名。

消息207,级别16,状态1,第2行
无效的列名称'text()'

sql sql-server

0
推荐指数
1
解决办法
62
查看次数