我收到错误:"Gradle项目同步失败.基本功能(例如,eiditing)将无法正常工作."
和错误日志:
Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.10/userguide/gradle_daemon.html
Please read below process output to find out more:
-----------------------
Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit. …
Run Code Online (Sandbox Code Playgroud) 我正在REST
使用api NodeJS
.对于身份验证我决定使用Passport
.我想要真正的RESTful api.所以这意味着我必须使用令牌而不是会话.
我想让用户使用用户名和密码登录,或者使用Facebook,Google和Twitter等社交网络.
我创建自己的OAuth2.0
服务器来发布Access
和Refresh tokens
使用oauth2orize
模块.所以现在我可以注册新用户,然后发出令牌.我按照本教程:
http://aleksandrov.ws/2013/09/12/restful-api-with-nodejs-plus-mongodb/
验证用户的路由:
// api ------------------------------------------------------------------------------------
app.get('/api/userInfo',
passport.authenticate('bearer', { session: false }),
function(req, res) {
// req.authInfo is set using the `info` argument supplied by
// `BearerStrategy`. It is typically used to indicate scope of the token,
// and used in access control checks. For illustrative purposes, this
// example simply returns the scope in the response.
res.json({ user_id: req.user.userId, name: req.user.username, …
Run Code Online (Sandbox Code Playgroud) node.js access-token express facebook-access-token passport.js
我SingleFramgnetActivity
的目的只是保持和替换其中的碎片.
布局看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context=".SingleFragmentActivity"
>
<include layout="@layout/toolbar"/>
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我正在替换Fragments
FrameLayout内部.当我fitsSystemWindows
在Fragment
布局上将其设置为true时,它没有响应.实际上它只在Activity
创建时才起作用,但是一旦我更换了Fragment
内部FrameLayout
,fitsSystemWindows
就会忽略该参数,并且布局位于状态栏和导航栏下方.
我找到了一些自定义FrameLayout的解决方案,它使用了弃用的方法,但由于某种原因它不适用于我(与普通FrameLayout相同的结果),我也不喜欢使用弃用方法的想法.
我正在尝试在Android 4.4上制作透明状态栏我知道如何通过定义自己的风格使其透明:
<style name="Theme.MyTheme" parent="Theme.MyTheme.Base">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item> </style>
Run Code Online (Sandbox Code Playgroud)
我在这里找到:https: //stackoverflow.com/a/20573595/2633630
问题是当状态栏是透明的时,它与操作栏的颜色不匹配,并且可以看到后台的活动:
所以我发现我可以在我的布局中使用android:fitsSystemWindows ="true"和android:clipToPadding ="false"我在这里找到http://mindofaandroiddev.wordpress.com/2013/12/28/making-the-status -bar-和导航条透明上带有一个-列表视图-ON-机器人-4-4-奇巧/
<LinearLayout 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"
android:background="@color/background_darkRed"
android:fitsSystemWindows="true"
android:clipToPadding="false"
tools:context="com.sandak.......">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
....
Run Code Online (Sandbox Code Playgroud)
这解决了透明状态栏的顶级问题,看起来没问题.不幸的是,"导航栏"底部有系统按钮的问题,这是红色的,不是我想要的透明:
我正在尝试所有可能的变体来实现工作结果,但我无法弄清楚如何解决它.我唯一可行的解决方案是将根元素的顶部填充大约60dp.但是这个解决方案很难看,并且在不同的设备上可能看起来不同,可能无法正常工作.
我发现Google Play上的一些应用程序在透明背景下工作正常,所以我很好奇他们是如何使它工作的.
例如:https: //play.google.com/store/apps/details?id = com.trello和其他一些人
嗨,我正在研究用于NFC支付的Android应用程序.
Android设置中有一个选项可以使用打开的应用程序而不是默认应用程序.例如,当我将默认应用程序设置为Android Pay并且在付款之前打开我的应用程序时 - 我想使用我的应用程序进行付款而不是默认应用程序.见图像波纹管.
我测试了它,但遗憾的是我用Android Pay而不是我在前台运行的应用程序付款.
我没有在文档中找到任何单词,如果我必须添加一些东西来清单,注册一些东西等.?
我service
跟intent filter
和meta data
我的清单,并当应用程序被设置为默认的付款,这是正常工作:
<service
android:name="com.example.MyWalletHceService"
android:exported="true"
android:permission="android.permission.BIND_NFC_SERVICE">
<intent-filter>
<action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
</intent-filter>
<meta-data
android:name="android.nfc.cardemulation.host_apdu_service"
android:resource="@xml/apduservice"/>
</service>
Run Code Online (Sandbox Code Playgroud)
添加apduservice xml内容:
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:apduServiceBanner="@drawable/ic_logo_nfc_system"
android:description="@string/nfc_service_title"
android:requireDeviceUnlock="false">
<aid-group
android:category="payment"
android:description="@string/nfc_aid_desc">
<!-- Following is a PPSE AID. You must always include this AID in order for payments to
work-->
<aid-filter android:name="@string/aid_number"/>
<!-- Following AID list is specific to the application requirements.
If your application supports the type of card that these AID …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Volley库与我的RESTful API进行通信.
当我要求持票人令牌时,我必须在正文中发布字符串.字符串应如下所示:grant_type = password&username = Alice&password = password123标题:Content-Type:application/x-www-form-urlencoded
有关WebApi个人账户的更多信息:http: //www.asp.net/web-api/overview/security/individual-accounts-in-web-api
不幸的是我无法弄清楚我该如何解决它..
我正在尝试这样的事情:
StringRequest req = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
VolleyLog.v("Response:%n %s", response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.e("Error: ", error.getMessage());
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("grant_type", "password");
params.put("username", "User0");
params.put("password", "Password0");
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError …
Run Code Online (Sandbox Code Playgroud) 我是Web Api的新手,我正在开发我的第一个项目.我正在为我们公司的移动CRM系统工作.
我想存储公司徽标,客户面对照片等.
我找到了一些关于这个主题的教程,但不幸的是其中一些是旧的(不使用异步)而其他的不起作用.
最后我找到了这个:http: //www.intstrings.com/ramivemula/articles/file-upload-using-mpartpartformdatastreamprovider-in-asp-net-webapi/ 它工作正常,但我不明白一些的东西.
1)我应该使用App_Data(或任何其他文件夹,如/ Uploads)来存储这些图像,还是将图像存储在数据库中?
2)我可以只设置.jpg,.png等支持的图像并拒绝任何其他文件吗?
3)如何在上传方法中处理图像?像调整大小,减少文件大小,质量等?
谢谢
我正在开发应该只安装在手机而非平板电脑上的应用程序.
我想问一下,我如何限制只在手机上安装?
我正在读这篇文章,但对我来说似乎很老了:分 发给特定的屏幕
他们根本不是在讨论xxhdpi或xxxhdpi分辨率,而是按屏幕尺寸划分设备.几年前它可以工作,但现在呢?例如,Nexus 6有6英寸的屏幕尺寸 - 它可以被认为几乎像平板电脑.
你知道任何有效的解决方案吗?
我正在使用BottomSheetDialogFragment
并且我需要知道状态何时改变。
例如有以下状态BottomSheetBehavior
PEEK_HEIGHT_AUTO - Peek at the 16:9 ratio keyline of its parent.
STATE_COLLAPSED - The bottom sheet is collapsed.
STATE_DRAGGING - The bottom sheet is dragging.
STATE_EXPANDED - The bottom sheet is expanded.
STATE_HIDDEN - The bottom sheet is hidden.
STATE_SETTLING - The bottom sheet is settling.
Run Code Online (Sandbox Code Playgroud)
我想根据当前状态更改一些视图 - 例如,当将BottomSheetDialogFragment
展开全屏时,我想在右上角显示十字图标以关闭它等。
我怎样才能听到此类事件?
android android-layout android-fragments material-design bottom-sheet
我正在研究NFC支付应用程序.即使设备被锁定,屏幕打开时也可以付款.与Android Pay基本相同的行为.付款后,我想向用户显示胜利屏幕,告知他付款结果 - 完成,错误,引脚请求等.
我把它添加到清单中
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
Run Code Online (Sandbox Code Playgroud)
在onCreate我正在设置这个标志
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_FULLSCREEN
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
Run Code Online (Sandbox Code Playgroud)
它在大多数设备上运行良好.但是一旦我将Nexus 5X更新到Android 8.1,它就停止了工作.NFC交易在后台完成,没有任何问题,但当我的手机处于锁定屏幕且屏幕打开时,根本不显示胜利屏幕.当5X解锁时,它会毫无问题地启动活动.然后我发现只有当应用程序没有在后台运行时才会起作用(当我进入设置并强制停止我的应用程序时).当我打开应用程序并将其保留在后台时,然后锁定我的手机并打开屏幕 - 它正在工作.但是当应用程序根本没有运行时 - 它将不会显示我的活动.在其他设备上,例如带有Andorid 7.0的三星S8,即使我强制停止我的活动并锁定手机也能正常工作.
我使用Android 8.1在5X上测试了Android Pay,它正在使用锁定屏幕.因此仍然可以在锁定屏幕上启动活动,但我可能在那里遗漏了一些东西.
先谢谢你.
android android-service android-fragments android-activity android-8.1-oreo
我需要格式化从用户到HTML的文本,但输入是多行,我必须将该字符串中的所有"输入"替换为HTML <br />
标记.
String message = messageEditText.getText().toString();
Run Code Online (Sandbox Code Playgroud)
这是我要格式化的消息.如何相应地格式化字符串?
android ×9
asp.net ×2
java ×2
rest ×2
.net ×1
access-token ×1
android-pay ×1
bottom-sheet ×1
c# ×1
express ×1
google-play ×1
gradle ×1
html ×1
nfc ×1
node.js ×1
passport.js ×1