有人可以ANDROID_HOME
通过终端发布有效的设置解决方案吗?
我的Android-SDK之路是/Applications/ADT/sdk
.
我正在为这个家庭作业制作一个简单的计算器,Java在除以0时返回"Infinity".
当我得到无限时,我需要显示一些错误信息.问题是我不知道该怎么办
double result;
result = 4/0;
//if result == infinity then some message - need help with this
Run Code Online (Sandbox Code Playgroud) 出于调试目的,我想打印整个请求体.我正在使用AFHTTPClient.打印客户端提供一些信息,如标题,但post/get params不存在.
有没有办法做到这一点?
我正在用这个简单的方法创建一个程序小部件
private ImageView getModuleIconView(Module module) {
ImageView view = new ImageView(context);
view.setImageResource(module.getIconResId());
view.getLayoutParams().height = 50; //NullPointerException
return view;
}
Run Code Online (Sandbox Code Playgroud)
我得到NullPointer异常,因为getLayoutParams返回null.这是为什么?
我正在用小部件升级我的应用程序.这不是我做过的第一个小部件.我总是遇到奇怪的问题,但最终小部件在列表中出现了问题.
这是我到目前为止所做的:
Run Code Online (Sandbox Code Playgroud)<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="110dp" android:minHeight="30dp" android:updatePeriodMillis="86400000" android:initialLayout="@layout/widget_layout" android:resizeMode="none"> </appwidget-provider>
<application>
部分中添加了要显示的小部件(由于某种原因,此处无法粘贴清单片段,它只是没有显示,请在此处查看代码)仍然无法在小部件列表中找到小部件.我在真实设备上调试应用程序.我正在使用库项目,但是小部件文件,但我在项目中直接运行.这可能发生什么?
我正在尝试使用SO中的一些代码,但它失败了:
那些是uri应该打开应用程序的正确部分.
facebook://facebook.com/info?user=544410940 (id of the user. "patrick.boos" won't work)
facebook://facebook.com/wall?user=544410940 (will only show the info if you have added it as
Run Code Online (Sandbox Code Playgroud)
我想要的是在我指定的配置文件上打开Facebook应用程序.这是我正在尝试的代码.该数字是配置文件的UID.
String uri = "facebook://facebook.com/wall?user=417079614970109";
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
是折旧还是什么?我现在如何完成这项任务?
有没有办法以编程方式打开电子邮件客户端,而无需强制发送邮件?我只是想让应用程序让用户打开他的电子邮件客户端以进行电子邮件检查:)
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, ""));
Run Code Online (Sandbox Code Playgroud)
此代码有效,但它强制用户发送新消息.
我正在尝试在真实设备上调试helloword示例.经过大量的搜索,我设法做了一些设置.
我在真实设备上调试了什么:
LOCAL_APP_ENGINE_SERVER_URL_FOR_ANDROID
值更改为http://192.168.1.107:8888
(我的计算机IP地址)--address=192.168.1.107
运行配置程序参数现在看起来像--address=192.168.1.107 --port=8888 "<path-to-project>/war
"http://192.168.1.107:8888/_ah/admin/
不幸的是,当我尝试在真实设备上进行通信时我得到的是:
GoogleJsonResponseException:500无法检索状态为404的API配置
附加了堆栈跟踪的完整错误html内容:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Failed to retrieve API configs with status: 404
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 Failed to retrieve API configs with status: 404</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /_ah/api/userendpoint/v1/user/jacek@gmail.com/11224. Reason:
<pre> Failed to retrieve API configs with status: 404</pre></p><h3>Caused by:</h3><pre>java.io.IOException: Failed to retrieve API configs with status: 404
at com.google.api.server.spi.tools.devserver.ApiServlet.getApiConfigSources(ApiServlet.java:102)
at com.google.api.server.spi.tools.devserver.ApiServlet.initConfigsIfNecessary(ApiServlet.java:67)
at com.google.api.server.spi.tools.devserver.RestApiServlet.service(RestApiServlet.java:117)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at …
Run Code Online (Sandbox Code Playgroud) 我无法按照需要在heroku上托管我的sinatra/ruby应用程序.我摆弄了一些试图解决这个问题的设置,但到目前为止还没有结果.
ActiveRecord::ConnectionNotEstablished - No connection pool for User:
2015-06-25T14:26:11.736854+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:566:in `retrieve_connection'
2015-06-25T14:26:11.736856+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
2015-06-25T14:26:11.736858+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_handling.rb:87:in `connection'
Run Code Online (Sandbox Code Playgroud)
用户是我的ActiveRecords表之一,应用程序失败,因为我尝试查询它.
我使用sinatra与puma备份.这是我的Procfile:
web: ruby app/my-server.rb -s puma
Run Code Online (Sandbox Code Playgroud)
我还在检查有多少打开的连接使用:
select count(*) from pg_stat_activity where pid <> pg_backend_pid() and usename = current_user;
Run Code Online (Sandbox Code Playgroud)
但它每次都说0.
我正在主持应用程序的免费计划和开发计划的herokupostgres.
我还注意到,在短时间内有2次快速调用api时会出现问题.就像只有1个,而不是5个连接可用,因为第一次呼叫成功,第二次呼叫失败.在我的database.yml中,我将池设置为5.
我在Rails 4.2.1和Postgres 9.4上
这是我的database.yml以及:
default: &default
adapter: postgresql
encoding: utf8
pool: 5
timeout: 5000
production:
<<: *default
host: my_db_address
port: 5432
database: my_db_name
username: my_db_user_name
password: my_db_password
< test and development ommited >
Run Code Online (Sandbox Code Playgroud)
我是否会错过一些配置或免费的heroku计划窒息?