我正在使用新的Java 7 IO功能,实际上我试图接收文件夹的所有xml文件.但是当文件夹不存在时会引发异常,如何检查该文件夹是否与新IO一起存在?
public UpdateHandler(String release) {
log.info("searching for configuration files in folder " + release);
Path releaseFolder = Paths.get(release);
try(DirectoryStream<Path> stream = Files.newDirectoryStream(releaseFolder, "*.xml")){
for (Path entry: stream){
log.info("working on file " + entry.getFileName());
}
}
catch (IOException e){
log.error("error while retrieving update configuration files " + e.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud) 如果我只有一个,有人可以解释我如何获取文件对象ByteArrayOutputStream.如何从ByteArrayOutputStream?创建文件?
我的app按钮后面有一个灰色边框,我该如何删除它?
我定义了ImageButton这样的:
<ImageButton
android:id="@+id/btn_photo_lib"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="startPhotoLibAction"
android:src="@drawable/library_blau_2" />
Run Code Online (Sandbox Code Playgroud) 是否可以从SQL Server中的存储过程生成csv文件?我创建了我的存储过程,我想将一些结果存储为csv,有人知道如何实现这一点吗?
在我的应用程序的信息区域中,我想显示我的应用程序的简要说明.为此,我需要创建一个包含大量文本的视图.最佳做法是什么?实际上我用Scrollview创建了一个线性布局,在这里我将添加我的文本,其中还应包含一些变量值,例如我的应用版本.但我不知道是否有更好的方法可以做到这一点?
这是我目前的做法:
<LinearLayout
android:id="@+id/information_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/bottom_footer"
android:layout_below="@id/top_header"
android:layout_marginLeft="@dimen/marginLeft"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<EditText
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:text="Hallo das ist ein test!!!
dsf" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
有什么建议?
谢谢
我看到有几个主题有相同的例外,但解决方案并不适合我.
我的规格:
几天前它一切都很好.现在我想启动它,然后它显示以下错误.可悲的是,我不能在这里附上图片,因为我的声誉很低.但是出现了错误"Java已启动但返回退出代码13"
这是myeclipse.ini的内容
#utf8 (do not remove)
-clean
-startup
../Common/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../Common/plugins/org.eclipse.equinox.launcher.i18n.win32.win32.x86_64_4.2.0.v201201111650
-install
k:\devel\Genuitec\MyEclipse 10
-vm
c:\java\bin\javaw.exe
-configuration
k:\devel\Genuitec\MyEclipse 10\configuration
-vmargs
-Xmx768m
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=96m
-Dosgi.nls.warnings=ignore
-Dfile.encoding=UTF8
Run Code Online (Sandbox Code Playgroud)
自从它最后一次工作以来我唯一做过的事情就是安装了python并更新了路径varable.我读到路径变量可能是原因,但我检查了它,看不到任何坏事.有人知道原因是什么.
谢谢
如何删除android中的Edittext字段的边框.实际上它看起来像这样
有了这个布局代码
<EditText
android:id="@+id/login_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:background="@android:drawable/editbox_background_normal"
android:visibility="invisible"
android:textColor="#FF0000"
android:layout_gravity="right"
/>
Run Code Online (Sandbox Code Playgroud)
尽管我定义了文本,但文本的对齐方式并不在右侧.
谢谢
实际上我的应用程序差不多到目前为止,有些人可以测试它.现在我想要一个应用程序的版本号.我应该在哪里放置version.properties还是有内置机制?
谢谢
有没有办法获取资产文件夹中的一个文件的文件对象.我知道如何加载这样一个文件的输入流,但我需要一个文件对象而不是输入流.
这样我加载输入流
InputStream in2 = getInstrumentation().getContext().getResources().getAssets().open("example.stf2");
Run Code Online (Sandbox Code Playgroud)
但是我需要文件对象,这样就找不到文件了
File f = new File("assets/example.stf2");
Run Code Online (Sandbox Code Playgroud)