我们有大量的应用程序.它们都有一个build.xml位于项目基目录中的文件.我正在尝试创建一个ant脚本,该脚本将通过并调用build.xml所有项目中每个文件的特定目标.
以下是问题:
我试图在属性文件中使用subant+ antfile并定义文件路径的CSV,但这不起作用.以下是我所拥有的和我得到的错误.
如果有更好的方法来做到这一点或者你知道我的问题是什么,请告诉我!谢谢!
这是属性文件中定义的属性.我希望运行脚本的人在这里添加相对于他们正在运行的脚本的当前位置的文件路径.
projects.to.build=
Run Code Online (Sandbox Code Playgroud)
这是我尝试在主构建脚本中使用的子任务.
<filelist
id="projectNames"
dir="${basedir}"
files="${projects.to.build}"
/>
<target name="debugAll" description="Builds all the projects listed in the projectNames.properties file.">
<subant target="debug" antfile="${projects.to.build}">
</subant>
</target>
Run Code Online (Sandbox Code Playgroud)
这是我在属性文件中定义项目时尝试运行构建脚本时得到的错误.我正在使用相对路径.例如:..\Apps\AnApp1\build.xml,..\Apps\AnApp2\build.xml,..\OtherApps\foo\AnotherApp1\build.xml
"No Build Path Specified" (at my subant task)
Run Code Online (Sandbox Code Playgroud) 从UI的角度来看,这两种方式可能更不一样.
有什么真正的区别吗?
因为使用Buttons实现的方式Tabs确实使事情变得更容易,所以只需复制并粘贴Buttons每个页面使其看起来像一个Tab.
EditText尝试输入时,软键盘掩盖了我的字段EditText。
如何防止软键盘遮盖我的EditText领域?
按下返回按钮后,我可以看到我输入的内容,因为软键盘不再覆盖了EditText。
我正在使用银河10.1英寸平板电脑。
XML格式
<ScrollView
android:layout_width="wrap_content"
android:layout_height="400dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="1) Project"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:id="@+id/projectET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:textSize="25sp"
android:ems="10"
android:hint="Project"
android:inputType="textCapWords"
android:layout_gravity="bottom"/>
<CheckBox
android:id="@+id/projectCBM"
android:layout_width="wrap_content"
android:layout_height="55dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="2) Customer"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:id="@+id/customerET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textCapWords"
android:layout_gravity="bottom"
android:textSize="25sp"
android:hint="Customer" />
<CheckBox
android:id="@+id/customerCBM"
android:layout_width="wrap_content"
android:layout_height="55dp" />
</LinearLayout> …Run Code Online (Sandbox Code Playgroud) 最近我按照了如何创建警告对话框的教程,当我点击删除按钮时,它应该在删除之前向我显示警告,但它会崩溃.有人能告诉我我的错误在哪里吗?
以下是我的代码:
// Delete button click event
btnDeleteEvent.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// alerting user before deleting event
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
getApplicationContext());
// set title
alertDialogBuilder.setTitle("Warning!");
// set dialog message
alertDialogBuilder
.setMessage("Are you sure to delete event?")
.setCancelable(false)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// if yes, deleting event in background
// thread
new DeleteEvent().execute();
}
})
.setNegativeButton("No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// if …Run Code Online (Sandbox Code Playgroud) 我已经看到了一些相似的帖子,但我已经ContentProvider注册了我的AndroidManifest.
我ContentProvider有个叫MyContentProvider.
并且MyContentProvider位于一个名为的图书馆项目中MyProject.随包裹位置personal.mobile.abc.angry.tiger.MyContentProvider.
我AndroidManifest的这个项目看起来像这样(省略了与之无关的信息):
<application
android:label=...
android:icon=...
android:theme=...>
<provider
android:name="personal.mobile.abc.angry.tiger.MyContentProvider"
android:authorities="personal.mobile.abc.angry.tiger">
</provider>
</application>
Run Code Online (Sandbox Code Playgroud)
林特一直这么说:
The <provider> personal.mobile.abc.angry.tiger.MyContentProvider is not registered in the manifest.
Run Code Online (Sandbox Code Playgroud)
当Logcat尝试运行包含包含以下内容的库的应用程序时,会说这个ContentProvider:
Failed to find provider info for personal.mobile.abc.angry.tiger
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?有什么问题?
如果您需要任何进一步的信息,请告诉我.
谢谢!
编辑:当我尝试实施建议的解决方案时发生错误.请查看以下附加信息.如果可以,请帮助我,提前谢谢!
好的,所以我最终得到了我的应用程序来创建和写入最近的文件.
在模拟器上,这非常有效.但是,当我将应用程序上传到手机并尝试adb shell进入手机时.我无法访问手机中包含该文件的目录.
目录是/data/data/cpe495.smartapp/files/.当我尝试更改目录时,它告诉我我没有权限.
我假设这是因为我的手机没有根,而且我不在root帐户中.根植我的手机不是我要做的事情.
有没有办法,我可以创建这个文件并写入它,并能够adb pull从我的手机?这是我创建文件的当前方式:
fOut = tThis.openFileOutput("test.csv", tThis.MODE_APPEND);
Run Code Online (Sandbox Code Playgroud)
提前致谢!!
还是行不通
我已将以下代码添加到我的应用程序中,当我运行它时,当它尝试将文件写入SD卡时,它失败并出现以下错误,请帮助我!
String inFileName = "/data/data/cpe495.smartapp/files/test.csv"; //TODO Use folder/filename
File inFile = new File(inFileName);
try{
FileInputStream fis = new FileInputStream(inFile);
String outFileName = Environment.getExternalStorageDirectory()+"/test.csv"; //TODO Use output filename
OutputStream output = new FileOutputStream(outFileName);
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(buffer))>0)
output.write(buffer, 0, length);
output.flush();
output.close();
fis.close();
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
04-05 23:20:11.551: WARN/System.err(285): …Run Code Online (Sandbox Code Playgroud) 我试图访问一个文件进行xml解析:
InputStream inputStream = context.getAssets().open("/mnt/sdcard/cat/bird/flowers.xml");
Run Code Online (Sandbox Code Playgroud)
当它运行时,我得到以下错误:
06-13 23:13:22.620: W/System.err(3118): java.io.FileNotFoundException: /mnt/sdcard/cat/bird/flowers.xml
06-13 23:13:22.620: W/System.err(3118): at android.content.res.AssetManager.openAsset(Native Method)
06-13 23:13:22.620: W/System.err(3118): at android.content.res.AssetManager.open(AssetManager.java:314)
06-13 23:13:22.620: W/System.err(3118): at android.content.res.AssetManager.open(AssetManager.java:288)
Run Code Online (Sandbox Code Playgroud)
我检查了文件的拼写,我已经多次检查过该位置.该文件在那里并正确命名.这里发生了什么?
谢谢
我从Robert Sedwick的一本关于算法的书中得到了以下代码.
我如何在以下语句中打破for循环 if (!(cin >> a[N])) break;
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int compare(const void *i, const void *j)
{ return strcmp(*(char **)i, *(char **)j); }
int main()
{ const int Nmax = 1000;
const int Mmax = 10000;
char* a[Nmax]; int N;
char buf[Mmax]; int M = 0;
for (N = 0; N < Nmax; N++)
{
a[N] = &buf[M];
if (!(cin >> a[N])) break;
M += strlen(a[N])+1;
}
// std::cout << "Number of …Run Code Online (Sandbox Code Playgroud) 怎么可能放Button一个ListView?喜欢这张图片?
我试过了:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:text="Button" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
但这Button是无法进入的......无论ListView是Button必须的还是必须的.
尝试将a设置CheckBox为checked 时,我收到空指针异常.
我的代码示例:
CheckBox something;
something.setChecked(true);
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?
我在Windows 64位上安装了Android sdk和Eclipse Indigo.但是当我启动Eclipse开始一个新项目时,我无法在Android文件夹下看到Android Project.
android ×11
android-file ×1
ant ×1
button ×1
c++ ×1
checkbox ×1
file ×1
inputstream ×1
listview ×1
root ×1
scrollview ×1
subant ×1