H TextViews里面有多个LinearLayout.现在我想在java中删除这个文本视图.视图是动态生成的.我怎样才能清空这里面的所有内容LinearLayout?
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/myid">
<TextView .../>
<TextView .../>
<TextView .../>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 在sdcard中打开文件时,我的代码正常工作.但是,如果我打开带有空格的文件名,则会出现错误(例如:路径 - "/ sdcard/download/hello hi.jpg").
我试过string.replace("","%20"); 它不起作用
try {
File file = new File(paths);
if (file.exists()) {
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(paths));
if (!mimeType.equals("")) {
intent.setDataAndType(path, mimeType);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else {
Toast.makeText(this, "Unsupported Format to Open", Toast.LENGTH_SHORT).show();
}
}
} catch (ActivityNotFoundException e) {
Toast.makeText(this, "No Application Available to View this File", Toast.LENGTH_SHORT).show();
} catch(Exception e) {
Toast.makeText(this, "Error Occurred", Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud)
请帮忙