小编Son*_*ony的帖子

使用Volley请求发送身份验证信息

在我的Android应用程序中,我必须调用一个看起来像这样的Web服务

http://mywesite.com/demo/mob/getmenubycategory/1
Run Code Online (Sandbox Code Playgroud)

我正在使用截击发送请求但结果是VolleyError 401.我已经覆盖了getParams()添加标题的方法,但它无法正常工作.

这是我的代码.

RequestQueue requestQueue = volleySingleton.getRequestQueue();
    requestQueue.add(new JsonObjectRequest(Request.Method.GET, url, new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            Log.e(TAG, "onResponse = \n " + response.toString());
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            Log.e(TAG, "response error \n" + error.networkResponse.statusCode);
        }
    }) {
        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            try {
                Map<String, String> map = new HashMap<String, String>();
                String key = "Authorization";
                String encodedString = Base64.encodeToString(String.format("%s:%s", "USERNAME", "Password").getBytes(), Base64.NO_WRAP); …
Run Code Online (Sandbox Code Playgroud)

authentication android basic-authentication android-volley

8
推荐指数
1
解决办法
2万
查看次数

数值在 firestore 中保存为字符串

我使用此功能将数据发送到 Firestore

exports.professional = functions.https.onRequest((request, response) => {
    const db = admin.firestore();

    const userId: string = request.body['userId'];
    const qualificationId: number = request.body['qualificationId'];
    const occupationId: number = request.body['occupationId'];
    const employmentType: EMPLOYMENT_TYPE = request.body['employmentType'];
    const collegeOrInstitution: string = request.body['collegeOrInstitution'];

    return db.collection('profiles').doc(userId)
        .set(
        {
            professional: {
                qualifaicationId: qualificationId,
                occupationId: occupationId,
                employmentType: employmentType,
                collegeOrInstitution: collegeOrInstitution
            }
        },
        {
            merge: true
        }).then(writeResult => {
           return response.json(
                {
                    status: 1,
                    message: 'Professional details saved successfully',
                    result: userId
                }
            )
        });
});
Run Code Online (Sandbox Code Playgroud)

我已经将一些变量声明为数字,但是当我检查 firestore 文档时,它被保存为字符串。请看截图

截屏

在代码中,我已声明occupationId …

typescript google-cloud-firestore

8
推荐指数
1
解决办法
5369
查看次数

Firebase显示应用版本需求调查

我的应用程序的firebase仪表板显示需求调查(分析 - >应用程序发布)我不知道它为什么会这样显示.请看截图

截图

搜索谷歌找出原因,但没有得到有用的链接.任何人都知道它为什么显示"需要调查"?

firebase firebase-analytics

8
推荐指数
1
解决办法
1918
查看次数

Javah错误,找不到类文件

当我尝试使用javah生成头文件时,我收到此错误:

Error: Could not find class file for 'HelloWorld'.
Run Code Online (Sandbox Code Playgroud)

这是我的外部工具配置.

位置:$ {system_path:javah}

工作目录:$ {workspace_loc:/ JniJava/bin/sonyraj}

参数:-jni HelloWorld

java-native-interface

6
推荐指数
1
解决办法
2万
查看次数

在recyclerview中附加onClickListener的最佳位置

虽然我正在查看有关recycleler view的一些教程.其中一些使用了viewHolder构造函数来附加onClick侦听器,而其中一些使用了onBindViewHolder方法.哪个方法是附加onclicklistener的最佳位置.我真的很困惑

android onclicklistener android-recyclerview

5
推荐指数
1
解决办法
2738
查看次数

在wix中检查注册表中的.net framework 4.5.2

如何使用wix在注册表中检查.net framework 4.5.2.我试过这个

<Property Id="WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED"/>
<Condition
  Message="This application requires .NET Framework 4.5.2. Please install the .NET Framework then run this installer again.">
  <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED]]>
</Condition
Run Code Online (Sandbox Code Playgroud)

但它不起作用.我正在使用wix v3.10

wix

4
推荐指数
1
解决办法
2342
查看次数

一起初始化服务帐户和云函数-Firebase

如何一起初始化云功能和服务帐户。在我的 index.ts 文件中,我已经使用初始化了函数

admin.initializeApp(functions.config().firebase);

但现在我想使用 firebase 创建自定义令牌,因此我创建了一个服务帐户并service-account.json在我的函数文件夹中添加了

const serviceAccount = require("./service-account.json");
admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://functionstest-54bd9 .firebaseio.com"
});
Run Code Online (Sandbox Code Playgroud)

上面的初始化函数。但是当我尝试部署该功能时,我在控制台中收到此错误

Error: The default Firebase app already exists. This means you called initializeApp() more than once without providing an app name as the second argument. In most cases you only need to call initializeApp() once. But if you do want to initialize multiple apps, pass a second argument to initializeApp() to give each app a unique name.
    at FirebaseAppError.FirebaseError [as …
Run Code Online (Sandbox Code Playgroud)

firebase service-accounts google-cloud-functions

3
推荐指数
1
解决办法
1878
查看次数

无法在运行时读取属性

当我试图读取"Left property"控件时,它给了我错误,

"Left cannot be read at run time"

这是我的代码,

for each ctrl in me.controls
    if ctrl.left > 2490 then
        'app logic
    end if
next
Run Code Online (Sandbox Code Playgroud)

这段代码有什么问题.它在另一台计算机上没有错误.任何人都可以告诉我有什么问题

vb6

2
推荐指数
1
解决办法
440
查看次数

卡片视图缩放动画

在我的应用程序中,我有一个cardview,其中包含一个文本视图和一个按钮,该按钮最初是隐藏的,当单击卡片视图时,会显示该按钮.我不知道如何在显示按钮时将其设置为动画.任何人都可以在代码或xml中建议一个很好的参考或教程来做到这一点.这是我的代码

这是我的自定义行

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="1dp"
android:elevation="5dp"
android:layout_margin="5dp">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="@dimen/customRowPadding">

    <TextView
        android:id="@+id/txtCustomRow"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="10dp"
        android:text="@string/sampleText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/btnHidden"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Hidden Button" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

适配器onBindViewHolder

 public void onBindViewHolder(MyViewHolder holder, int position) {
    holder.tv.setText(list.get(position));
    holder.Btn.setText("Hidden Button " + (position + 1));
    holder.Btn.setVisibility(View.GONE);
}
Run Code Online (Sandbox Code Playgroud)

查看Holder和clicklistener

static class MyViewHolder extends RecyclerView.ViewHolder {

    TextView tv ;
    Button Btn;
    public MyViewHolder(View itemView) {
        super(itemView);
        tv = (TextView) itemView.findViewById(R.id.txtCustomRow);
        Btn = (Button) itemView.findViewById(R.id.btnHidden);
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public …
Run Code Online (Sandbox Code Playgroud)

android android-cardview

2
推荐指数
1
解决办法
6574
查看次数

在休眠中的另一个实体中使用同一实体两次

假设一个名为 Student 的类/实体,其中包含 id、父亲的职业和母亲的职业,实体类如下所示

学生班

@Entity
@Table(name = "student")
public class Student {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(nullable = false, unique = true, updatable = false)
    private int id;

    @OneToOne
    @JoinColumn(name = "occupationId")
    Occupation fathersOccupation;

    @OneToOne
    @JoinColumn(name = "occupationId")
    Occupation mothersOccupation;

}
Run Code Online (Sandbox Code Playgroud)

和职业类别

@Entity
@Table(name = "occupation")
public class Occupation {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "occupationId")
    int occupationId;

    @Column
    String title;

}
Run Code Online (Sandbox Code Playgroud)

当我尝试@OneToOne映射父亲的职业和母亲的职业时,它抛出异常Repeated column in mapping for entity。我尝试添加@Column(name="<columnName>"),但这是不允许的。我真的想要这两个字段,fathersOccupation并在学生表中进行映射mothersOccupation。 …

java hibernate one-to-one hibernate-mapping

2
推荐指数
1
解决办法
2071
查看次数