我正在使用异步任务从菜单活动中获取字符串并加载一些东西..但我无法这样做..我以正确的方式使用它并且我正确地传递参数?请参阅代码段.谢谢
private class Setup extends AsyncTask<Void, Integer, Void> {
@Override
protected Void doInBackground(Void... params) {
try {
if (!(getIntent().getExtras().isEmpty())) {
Bundle gotid = getIntent().getExtras();
identifier = gotid.getString("key");
}
} catch (Exception e) {
e.getStackTrace();
} finally {
if (identifier.matches("abc")) {
publishProgress(0);
db.insert_fri();
} else if ((identifier.matches("xyz"))) {
publishProgress(1);
db.insert_met();
}
}
return null;
}
@Override
protected void onProgressUpdate(Integer... i) {
// start the song here
if (i[0] == 0) {
song.setLooping(true);
song.start();
}
}
@Override
protected void onPostExecute(Void res) { …Run Code Online (Sandbox Code Playgroud) 当我在模拟器上运行我的应用程序时,我收到标题中提到的错误.创造它时,我给了足够的空间.
你怎么解决这个问题?
我的日志文件:
[2011-09-16 09:28:17 - Trivia] Performing nik.trivia.Splash activity launch
[2011-09-16 09:28:17 - Trivia] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'work'
[2011-09-16 09:28:17 - Trivia] Uploading Trivia.apk onto device 'emulator-5554'
[2011-09-16 09:30:54 - Trivia] Installing Trivia.apk...
[2011-09-16 09:30:56 - Trivia] Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE
[2011-09-16 09:30:56 - Trivia] Please check logcat output for more details.
[2011-09-16 09:30:56 - Trivia] Launch canceled!
Run Code Online (Sandbox Code Playgroud) 目前,我有以下两个功能:
void write_to_file(FILE *fp)
{
fprintf(fp, "stuff here: %d", 10);
/* 1000s of similar lines below */
}
Run Code Online (Sandbox Code Playgroud)
和
void write_to_string(char *str)
{
sprintf(str, "stuff here: %d", 10);
/* 1000s of similar lines below */
}
Run Code Online (Sandbox Code Playgroud)
我想将它变形为单个函数.我想过类似的东西:
void write_somewhere(void *ptr, int to_file)
{
if (to_file) {
typedef fprintf myprintf;
} else {
typedef sprintf myprintf;
}
myprintf(ptr, "stuff here: %d", 10);
}
Run Code Online (Sandbox Code Playgroud)
这不起作用,看起来很难看.
由于签名fprintf和sprintf不同而如下,
int fprintf(FILE *stream, const char *format, …);
int sprintf(char *buffer, const char …Run Code Online (Sandbox Code Playgroud) 代码段如下.无法理解为什么我收到此错误.
void
SipObj::check_each_field()
{
map <std::string, sip_field_getter>::iterator msg;
string str;
char name[20];
bool res = false;
sscanf(get_payload(), "%s %*s", name);
LOGINFO(lc()) << "INVITE:" << name;
str = name;
msg = sip_field_map.find(str);
if (msg != sip_field_map.end()) {
sip_field_getter sip_field = msg->second;
res = (this).*sip_field();
}
}
typedef bool (SipObj::*sip_field_getter)();
static map <std::string, sip_field_getter> sip_field_map;
sip_field_getter is a place holder for function names
Run Code Online (Sandbox Code Playgroud) 我有大约80个静态库.我想从中创建一个静态库.
这个答案对我不起作用,因为我收到以下错误:
libtool: unrecognized option `-static'
Run Code Online (Sandbox Code Playgroud)
我也很困惑它需要在哪种模式下完成.是"链接"还是"安装"因为有20个奇数库,我还能用"*"来指定所有吗?
我没有在文件中找到任何信息,期望这不能真正回答我的问题.
FYI ..这些是模式:
MODE must be one of the following:
clean remove files from the build directory
compile compile a source file into a libtool object
execute automatically set library path, then run a program
finish complete the installation of libtool libraries
install install libraries or executables
link create a library or an executable
uninstall remove libraries from an installed directory
Run Code Online (Sandbox Code Playgroud) "发生了意外错误.请稍后重试."是我在尝试上传已签名的apk时遇到的错误.一旦我完成了我的应用程序,我使用Export signed application tool生成密钥.为什么我收到此错误?
发送一个 FIN 表示该端不会发送任何数据。但是它可以发送 TCP keepalive 吗?
如果可以,那么即使它是保活但不是数据,它也与“在 FIN 之后发送内容”的声明相矛盾。
如果它不发送keepalive,它就不会检测到另一端是否消失了。
例如:
客户端发送 FIN 并得到 ACK。然后服务器发送了一个丢失的重置。客户端可以检测到服务器已消失的唯一方法是发送 keepalive,它将以重置进行响应,然后客户端关闭。
这会发生吗?
我的计划如下:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
int main()
{
struct sigaction new_sa;
struct sigaction old_sa;
sigfillset(&new_sa.sa_mask);
new_sa.sa_handler = SIG_IGN;
new_sa.sa_flags = 0;
int input;
if (sigaction(SIGTERM, &new_sa, &old_sa) == 0 && old_sa.sa_handler != SIG_IGN) {
new_sa.sa_handler = NULL;
sigaction(SIGTERM, &new_sa, 0);
}
printf("Pgm is running\n");
while (1) {
printf("Enter input\n");
scanf("%d", &input);
if (!input) {
/* I actually call a libraries API which calls exit()
* Just calling exit here for simpilicity */
exit(1);
}
}
} …Run Code Online (Sandbox Code Playgroud) 我有5首我需要一个接一个播放的歌曲,它必须在完成第5首歌后从第一首歌曲中循环播放.如何使用MediaPlayer实现此目的?