我试图读取文件夹中的文件,但是当我运行该程序时,它会抛出此异常.我也尝试过其他一些文件夹.它引发了同样的异常.
Exception in thread "main" java.io.FileNotFoundException: C:\backup (Access is denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
Run Code Online (Sandbox Code Playgroud) 我正在创建一个应用程序,我遇到了问题Cursor.当我尝试使用此函数获取值时SQLiteDatabase,我有一个返回给Cursor我:
public Cursor fetchOption(long rowId) throws SQLException {
Cursor mCursor = mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何获得该领域的价值Cursor.如果我这样做:
String a = mOptionDb.fetchOption(0).getColumnName(0).toString();
String b = mOptionDb.fetchOption(0).getColumnName(1).toString();
String c = mOptionDb.fetchOption(0).getColumnName(2).toString();
Run Code Online (Sandbox Code Playgroud)
我只获取列(_id, title, body)的名称,但不获取值.有关如何实现这一目标的任何建议?
我尝试使用input.setImeOptions(EditorInfo.IME_ACTION_DONE)在软键盘上设置"完成"按钮;
但"完成"按钮根本不会显示在软键盘上.
有什么建议吗?
public void modif(int position) {
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
alert.setTitle("Modifica");
EditText input = new EditText(MainActivity.this);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
alert.setView(input);
final Editable value = input.getText();
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Toast.makeText(getApplicationContext(), value, Toast.LENGTH_LONG).show();
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试生成我的指纹,它应该在这里:~/.android/debug.keystore,但我没有任何东西,虽然我也可以正常运行我的monodroid项目,所以我怎样才能找到debug.keystore文件?
int total=0, number=0;
float percentage=0.0;
percentage=(number/total)*100;
printf("%.2f",percentage);
Run Code Online (Sandbox Code Playgroud)
如果数字的值是50并且总数是100,那么我应该得到50.00的百分比,至少这是我想要的.但我一直得到0.00作为答案,并尝试了很多类型的变化,但无济于事.
我想在应用程序中使用URLEncoder/URLDecoder类(java.net.URLEncoder/URLDecoder)和方法:encode(String s,String enc)/ decode(String s,String enc),但我不知道是什么可以是String参数enc的值吗?我想在"x-www-form-urlencoded"MIME内容类型中编码/解码.谢谢您的帮助.
我正在尝试使用Google+ SignIn创建新的ParseUser.虽然我能够从Google成功检索访问令牌,但我得到了一个ParseException(InvalidSession).我将发布几个相关的片段.
这就是我从谷歌获取AccessToken的方式
final String SCOPES = "https://www.googleapis.com/auth/plus.login ";
token = GoogleAuthUtil.getToken(
MainActivity.this,
Plus.AccountApi.getAccountName(mGoogleApiClient),
"oauth2:" + SCOPES);
Run Code Online (Sandbox Code Playgroud)
制作ParseUser
ParseUser.becomeInBackground(token, new LogInCallback()
{
public void done(ParseUser user, ParseException e)
{
Log.i(TAG, "makeParseUser"+"2");
if (user != null)
{
// The current user is now set to user.
/*
user.put("name", s1);
user.put("email",s6);
user.saveInBackground();
*/
}else
{
// The token could not be validated.
Log.i(TAG, "makeParseUser"+e.getLocalizedMessage());
}
}
});
Run Code Online (Sandbox Code Playgroud)
我想在MAC OSX Yosemite上的Android Studio 1.0项目中从我的build.gradle运行ndk-build.
task ndkBuild(type: Exec) {
commandLine 'ndk-build', '-C', file('src/main').absolutePath
}
Run Code Online (Sandbox Code Playgroud)
我在local.properties文件中指定了ndk-dir,但是我收到了这个错误
A problem occurred starting process 'command 'ndk-build'
Run Code Online (Sandbox Code Playgroud)
如果我从命令行运行gradle脚本,那么一切都成功构建
./gradlew :myproject:assembleDebug
Run Code Online (Sandbox Code Playgroud)
因此,由于某种原因,IDE无法调用ndk-build.我在Android studio中启用了一些调试信息,我有以下错误
Caused by: java.io.IOException: error=2, No such file or directory
Run Code Online (Sandbox Code Playgroud)
因此IDE无法找到ndk-build exe,但是从IDE内部的终端运行可以找到ndk-build exe.
谢谢
我正在为一个Android项目做一个Get和Post方法,我需要将HttpClient 3.x"翻译"到HttpClient 4.x(由android使用).我的问题是,我不确定我做了什么,我找不到某些方法的"翻译"......
这是我做过的HttpClient 3.x和( - >)HttpClient 4.x"翻译"如果我找到它(只有那些问我问题的人):
HttpState state = new HttpState (); --> ?
HttpMethod method = null; --> HttpUriRequest httpUri = null;
method.abort(); --> httpUri.abort(); //httpUri is a HttpUriRequest
method.releaseConnection(); --> conn.disconnect(); //conn is a HttpURLConnection
state.clearCookies(); --> cookieStore.clear(); //cookieStore is a BasicCookieStore
HttpClient client = new HttpClient(); --> DefaultHttpClient client = new DefaultHttpClient();
client.getHttpConnectionManager().getParams().setConnectionTimeout(SOCKET_TIMEOUT) --> HttpConnectionParams.setConnectionTimeout(param, SOCKET_TIMEOUT);
client.setState(state); --> ?
client.getParams().setCookiePolicy(CookiePolicy.RFC_2109); --> HttpClientParams.setCookiePolicy(param, CookiePolicy.RFC_2109);
PostMethod post = (PostMethod) method; --> ?
post.setRequestHeader(...,...); --> conn.setRequestProperty(...,...);
post.setFollowRedirects(false); --> …Run Code Online (Sandbox Code Playgroud) android ×7
java ×5
android-ndk ×1
c ×1
google-maps ×1
google-plus ×1
gradle ×1
http ×1
ime ×1
int ×1
macos ×1