所以我有一个接受用户名和密码的对话框,但是当我尝试从EditText对象获取用户名和密码时,我似乎无法EditText从资源中获取对象,我的代码看起来像这样.
protected Dialog onCreateDialog(int ID){
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.login_dialogue, null);
return new AlertDialog.Builder(this)
.setTitle("Login:")
.setView(textEntryView)
.setPositiveButton("login", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* Problem occurs below */
View aView = findViewById(R.id.login_dialogue_username);
String username = ((EditText) aView).getText().toString();
String password = ((TextView) findViewById(R.id.login_dialogue_password)).getText().toString();
boolean success = attemptLogin(username, password);
}
})
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked cancel so do some stuff …Run Code Online (Sandbox Code Playgroud) 以下代码给出了一个错误:"expected';' 在'{'token"之前.谁能明白为什么?
do {
r = rand() % numElements;
} while ([questionsShown containsObject:r] && myCount < numElements) {
//code here…
}
Run Code Online (Sandbox Code Playgroud) 我在获取远程计算机桌面的 x11 窗口时遇到问题。
我通过 VPN 连接到本地网络,我可以使用以下命令通过命令行进入我想要的计算机:
ssh -X computer_name -l login_name
Run Code Online (Sandbox Code Playgroud)
我认为 -X 会导致远程机器的桌面在 x11 中弹出,虽然 x11 在我的 mac 上启动,但我没有得到机器桌面的 x11 窗口。
我可以让 emacs 之类的东西在新的 x11 窗口中运行和弹出,但我想让整个桌面运行起来。
我运行的是 Mac OS 10.7,远程机器运行的是 linux。
任何帮助,将不胜感激。
由于某种原因,我在使用c ++中的exit()函数.我从mac运行狮子(64位)得到各种奇怪的错误.我正在编译使用g++ -o -g -Wall.
图表A:
#include <iostream>
int main(int arc, char *argv[]){
exit(1);
}
Run Code Online (Sandbox Code Playgroud)
终端输出如下所示
$ g++ -o -g -Wall test main.cpp
ld: in test, can't link with a main executable for architecture x86_64
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
但$ g++ -o test main.cpp编译得很好.
使用#include<stdio.h>或#include<stdlib.h>导致相同的编译错误.
我只是想知道是否有人能够立即看到这里发生了什么?
我不知道这个问题的标题是否恰当.
我有一个侧边栏,其中填充了可表示数据库中对象的可点击div.当用户点击其中一个div时,我想通过ajax获取更多详细信息,并在主要内容区域显示收到的信息.
每个侧边栏div都需要与之关联id,我可以使用我的javascript传递给服务器.
我想知道我应该把这个id放在页面上?
有这样做的最佳实践方法吗?
ajax ×1
android ×1
c++ ×1
conditional ×1
dialog ×1
html ×1
jquery ×1
linux ×1
macos ×1
objective-c ×1
ssh ×1
std ×1
while-loop ×1
x11 ×1