我有Fragment一个ListView.在适配器中我想创建一个对话框.
class ViewHolder {
...
@Override
public void onClick(View v) {
...
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
mContext是Context我的Fragment,我在创建适配器时保存全局.我收到了错误.
unable to add window -- token null is not for an application
该方法getActivity()不可用,所以如何得到Context我的Activity?
我是hadoop的新手.在单节点上安装了hadoop-2.2.0之后,我访问了url:localhost:9000,它返回了以下结果:
看起来您正在向Hadoop IPC端口发出HTTP请求.这不是此守护程序上Web界面的正确端口.
我已经配置了我的core-site.xml,如下所示:
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
<description>The name of the defaultfile system. Either the literal string "local" or a host:port.
</description>
<final>true</final>
</property>
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?提前致谢.
我是android的新手,我现在正试图实现一个WebView例子.在我的应用程序中,WebView重定向到网页.但是在Logcat中,这是它显示的错误.我试图解决它,但我不能.帮我找到它.如果我的问题困扰你,我真的很抱歉.这是错误:
01-02 22:46:42.764: E/chromium(1223): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
01-02 22:46:42.764: E/chromium(1223): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
01-02 22:46:42.784: E/chromium(1223): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
01-02 22:46:42.784: E/chromium(1223): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
01-02 22:46:42.784: E/chromium(1223): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed
01-02 22:46:42.764: E/chromium(1223): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
01-02 22:46:42.764: E/chromium(1223): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
01-02 22:46:42.784: E/chromium(1223): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
01-02 22:46:42.784: E/chromium(1223): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
01-02 22:46:42.784: E/chromium(1223): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed
01-02 22:46:44.724: W/AwContents(1223): …Run Code Online (Sandbox Code Playgroud) 我正在使用eclipse上的maven 2项目,我有m2e插件,我在Eclipse中遇到以下错误:
Failure to transfer com.thoughtworks.xstream:xstream:pom:1.3.1 from http://repo1.maven.org/maven2 was cached in the
local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer artifact com.thoughtworks.xstream:xstream:pom:1.3.1 from/to central (http://
repo1.maven.org/maven2): Failed to create a selector. to http://repo1.maven.org/maven2/com/thoughtworks/xstream/
xstream/1.3.1/xstream-1.3.1.pom
Run Code Online (Sandbox Code Playgroud)
我通过删除.lastUpdated文件然后清理和构建没有运气,仍然得到相同的错误,请遵循类似问题的答案,请指教.
我正在使用Android开发者网站上下载的最新版本的ADT Bundle.我在Windows 7上.由于我从Windows收到以下崩溃消息,我的R.java文件无法正确编译:

这是问题详细输出:
Problem signature:
Problem Event Name: APPCRASH
Application Name: aapt.exe
Application Version: 0.0.0.0
Application Timestamp: 52684cb5
Fault Module Name: aapt.exe
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 52684cb5
Exception Code: c0000005
Exception Offset: 0003cf2a
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt …Run Code Online (Sandbox Code Playgroud) 我想启用Android ActionBar,但它对我不起作用.
这是我的MainActivity:
public void onCreate(Bundle savedInstanceState) {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
ActionBar actionBar = getActionBar();
actionBar.show();
//more code............
Run Code Online (Sandbox Code Playgroud)
这是logcat:
03-04 16:31:09.423: E/AndroidRuntime(1441): FATAL EXCEPTION: main
03-04 16:31:09.423: E/AndroidRuntime(1441): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.salebook/com.example.salebook.MainActivity}: java.lang.NullPointerException
03-04 16:31:09.423: E/AndroidRuntime(1441): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-04 16:31:09.423: E/AndroidRuntime(1441): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-04 16:31:09.423: E/AndroidRuntime(1441): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-04 16:31:09.423: E/AndroidRuntime(1441): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-04 16:31:09.423: E/AndroidRuntime(1441): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 16:31:09.423: E/AndroidRuntime(1441): at android.os.Looper.loop(Looper.java:137)
03-04 16:31:09.423: E/AndroidRuntime(1441): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-04 16:31:09.423: E/AndroidRuntime(1441): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 16:31:09.423: …Run Code Online (Sandbox Code Playgroud) 我有一个ListView包含RatingBar来表示一些东西,如果你单击LisView的项目它弹出一个包含RatingBar的Dialog(AlertDialog),现在我想知道:
我目前的代码是:
final RatingBar ratingBar = new RatingBar(getApplicationContext());
ratingBar.setRating(0);
ratingBar.setStepSize(1);
ratingBar.setNumStars(2);
builder.setTitle(R.string.alertdialog_title)
.setIcon(android.R.drawable.ic_dialog_info)
.setView(ratingBar)
.setPositiveButton("Submit", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do something.
}
})
.setNegativeButton("Cancel", null);
Run Code Online (Sandbox Code Playgroud)
Edit1
我已经使用fileListAdapter(FileListAdapater的一个实例作为code1)显示了listview项的评级.现在的问题是:
我已将onItemClickListener上的对话框代码作为code2.
代码1:
public class FileListAdapter extends BaseAdapter {
private Context context;
private ArrayList<File> files; // The ArrayList to store the files
private boolean isSDcard; // To indicate whether the file is the …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用clang编译器的openmp代码
我通过git下载了代码并且做了make和make install.它成功安装了具有openmp支持的clang编译器.但是当我尝试编译示例代码(在上面的链接中指定)时,我收到以下错误:
/ usr/bin/ld:找不到-liomp5
我没有指定网站中提到的包含和lib的路径,但我打算在使用-L和-I选项在命令行上编译时指定它们.
$clang -I/usr/lib/gcc/i686-linux-gnu/4.6/include -fopenmp test.c -o test
但是,我找不到iomp5 lib的路径,因此我得到了上述错误.有人可以告诉我如何解决这个问题?
我正在使用Android中的应用程序.它使用我的PC中的本地主机服务器来获取一些数据.但是在跑完之后我会在LotCat中收到警告.
02-07 15:51:48.965:W/System.err(10339):com.sun.jersey.api.client.ClientHandlerException:java.net.ConnectException:无法连接到localhost/127.0.0.1(端口9090):连接失败:ECONNREFUSED(拒绝连接)
我正在使用真实设备连接到PC并运行我的应用程序.android:permission:internet已在AndroidManifest.xml中启用.我使用的真实设备是带有Androidv4.2.2的hTC移动设备.我没有使用asyncTask来调用此Web服务.谁能帮帮我吗....
我使用ibtool从我的Base Storyboard为我的所有语言生成我的String- Files ...出于某种原因,ibtool没有提取UILabel带有"属性"的样式的s ...
我没有那些标签的键/值对...有人知道为什么?!