小编Joi*_*ois的帖子

如何在Android Lollipop中使用带边框的EditText

我正在开发一款Android应用.我需要知道如何使用带边框的EditText.在Lolipop中,他们完全改变了EditText风格.我们可以不使用drawables吗?

android android-layout

40
推荐指数
3
解决办法
8万
查看次数

在MVVM架构Android中启动服务的正确位置是什么

我刚开始在Android上使用MVVM架构.我有一个基本上获取一些数据并更新UI的服务,这是我从MVVM中理解的:

  • 活动不应该对数据有任何了解,应该注意观点
  • ViewModels不应该知道活动
  • 存储库负责获取数据

现在,由于ViewModels不应该对活动有任何了解,而且活动除了处理视图之外不应该做任何事情,任何人都可以告诉我应该在哪里开始服务?

android mvvm kotlin

7
推荐指数
2
解决办法
1054
查看次数

Redux-Saga的Firebase身份验证无法正常运行

我正在尝试使用firebase auth创建一个新用户.我正在使用redux-saga进行上述调用.

下面是我的saga.js:

import { takeLatest, put } from 'redux-saga/effects';
import { SIGN_UP, AUTHENTICATION_FAILED, SIGN_UP_SUCCESS} from '../actions/index';
import firebase from 'firebase';


function* signUp(action){
    console.log("about to call authentication"); // This being printed
    firebase.auth().createUserWithEmailAndPassword(action.user.email, action.user.password)
            .then(function*(result){
                    console.log("success"); // Not being loged
                    yield put({SIGN_UP_SUCCESS, user: action.user});
            }).catch(function*(error){
                    console.log("failed"); //Not being loged
                    let error_message = { code: error.code, message: error.message};
                    yield put({AUTHENTICATION_FAILED, error: error_message});
            });
}

function* rootSaga(){
  yield takeLatest(SIGN_UP, signUp);
}

export  default rootSaga;
Run Code Online (Sandbox Code Playgroud)

内部thencatch未执行的代码,正在调用注册生成器函数.谁能告诉我我做错了什么?

javascript firebase react-native redux redux-saga

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

尝试将字典写入CSV文件时,Str属性没有键

我正在尝试使用以下代码将字典写入CSV文件:

def condense_data(in_file, out_file, city):
"""
This function takes full data from the specified input file
and writes the condensed data to a specified output file. The city
argument determines how the input file will be parsed.

HINT: See the cell below to see how the arguments are structured!
"""

with open(out_file, 'w') as f_out, open(in_file, 'r') as f_in:
    # set up csv DictWriter object - writer requires column names for the
    # first row as the "fieldnames" argument

    out_colnames …
Run Code Online (Sandbox Code Playgroud)

python csv dictionary

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

Android Volley同步请求无法正常工作

我试图使用RequestFuture向服务器发出同步请求,但它无法正常工作.使用异步完成时相同的请求工作正常.

这是我的代码:

 public void fetchModules(){
   JSONObject response = null;
    RequestQueue requestQueue = Volley.newRequestQueue(getContext());

    RequestFuture<JSONObject> future = RequestFuture.newFuture();
    JsonObjectRequest request = new JsonObjectRequest(Url.ALL_MODULES_URL,null,future,future);
    requestQueue.add(request);


    try {
         response = future.get(3, TimeUnit.SECONDS); // Blocks for at most 10 seconds.
    } catch (InterruptedException e) {
             Log.d(TAG,"interupted");
     } catch (ExecutionException e) {
        Log.d(TAG,"execution");
    } catch (TimeoutException e) {
        e.printStackTrace();
    }

    Log.d(TAG,response.toString());
}
Run Code Online (Sandbox Code Playgroud)

我得到一个nullpointerexception:

java.lang.NullPointerException:尝试在com.maths.app.AllModules.fetchModules(AllModules.java:85)的空对象引用上调用虚方法'java.lang.String org.json.JSONObject.toString()'在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager)的android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)上的com.maths.app.AllModules.onCreateView(AllModules.java:51). java:1108)在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)的android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)android.support.v4.app在Android.os的android.os.Handler.handleCallback(Handler.java:746)的android.support.v4.app.FragmentManagerImpl $ 1.run(FragmentManager.java:536)的.FragmentManagerImpl.execPendingActions(FragmentManager.java:1677) .Handler.dispatchMessage(Handler.java:95)位于android.app.Looper.loop(Looper.java:148)的android.app.ActivityThread.main(ActivityThread.java:5443),位于java.lang.reflect.Method.调用(娜 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)的com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:728)中的tive方法)

它返回一个null响应.我怎么解决这个问题?

java android android-volley

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

jQuery append(),属性ng-model不起作用

我试图在用户执行特定操作时将具有ng-model属性的新HTML元素附加到ap标记,但ng模型不起作用.这是我的代码.

    <!DOCTYPE html>
<html>

<head>
          <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
             <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>


      <style>
          p{
              height: 600px;
              width: 600px;
              font-size:17px;  
          }



      </style>

    </head>
    <body>



           <div ng-app="myApp" ng-controller="editor">
            <label for="kys_font_size"> font size:</label>

            <select ng-model="kys_selected_font" id="fontsize" name="kys_font_size" ng-options="page for page in FontSize(1, 150)" ng-change="changeFont()">
               </select>   


                <p contenteditable="true"  id="content"   >


                </p>

              <p>{{fonttext}}</p>
          </div>





         <p></p>

         <script>

           var app = angular.module('myApp',[]);
             app.controller('editor',function($scope){

                 $scope.fonttext="hello";
                 $scope.FontSize = function(start, end) {
                                      var size = [];
                                       for (var i = start; i <= end; i++) {
                                       size.push(i);
                                       }
                            return size; …
Run Code Online (Sandbox Code Playgroud)

jquery angularjs

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

Firebase数据库删除所有节点等于特定值

我有一个用户列表,其中包含一个名为的节点scannedCards,其中包含一个数组cardIds.以下是一个用户的屏幕截图.

以下是一个用户的屏幕截图

有多个像上面这样的用户,我想删除所有的卡ID,如果它们是equalTo(Some Card Id),我想同时与所有用户一起.

以下是我使用的查询:

  const ref = database.ref('users');
  const query = ref.orderByChild('cardId').equalTo(cardId);
Run Code Online (Sandbox Code Playgroud)

但结果总是空的,有人可以告诉我如何实现这一目标吗?

javascript firebase react-native firebase-realtime-database

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

Redux saga Firebase回调

我正在尝试使用redux-saga在react-native中注册firebase回调,但我无法弄清楚如何(我是redux-saga的新手).下面是我想在redux saga中编写的代码:

firebase.auth().onAuthStateChanged((user) => {
      if (user) {
        console.log('user logged')
      }
   });
Run Code Online (Sandbox Code Playgroud)

react-native redux redux-saga

0
推荐指数
1
解决办法
560
查看次数