小编Jan*_*Jan的帖子

LogCat缺少过滤器选项

过滤器是一个设备选项卡.但这不应该是在logcat中.

你怎么重置它们?

android-studio

141
推荐指数
12
解决办法
2万
查看次数

如何在API 18及更低版本上检查位置是否已开启且具有高优先级

试过这个:

String locationProviders = Settings.Secure.getString(getActivity().getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
Log.d(TAG_MAP, locationProviders);
Run Code Online (Sandbox Code Playgroud)

输出是:gps,网络

API 18及以下的手机是否具有HIGH_ACCURACY优先级?

android

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

使用twitter按钮登录的结构显示为灰色

我按照说明使用Fabric在我的自定义应用程序中实现登录.

问题是,当我运行我的应用程序时,按钮显示为灰色.

以下是我的堆栈跟踪错误:

03-20 11:06:32.456    6509-6509/com.jan.simplesharing E/Twitter? Must Initialize Fabric before using singleton()

03-20 11:06:32.546    6509-6509/com.jan.simplesharing E/IMGSRV? :0: PVRDRMOpen: TP3, ret = 46
03-20 11:06:32.556    6509-6509/com.jan.simplesharing E/IMGSRV? :0: PVRDRMOpen: TP3, ret = 49
03-20 11:06:32.556    6509-6509/com.jan.simplesharing E/IMGSRV? :0: PVRDRMOpen: TP3, ret = 50
03-20 11:06:32.556    6509-6509/com.jan.simplesharing E/IMGSRV? :0: PVRDRMOpen: TP3, ret = 50
03-20 11:06:32.556    6509-6509/com.jan.simplesharing E/IMGSRV? :0: PVRDRMOpen: TP3, ret = 50
03-20 11:06:32.566    6509-6509/com.jan.simplesharing E/IMGSRV? :0: PVRDRMOpen: TP3, ret = 52
Run Code Online (Sandbox Code Playgroud)

但我也在我的活动中初始化了面料.

这是一个片段:

import io.fabric.sdk.android.Fabric;

import com.twitter.sdk.android.Twitter;
import …
Run Code Online (Sandbox Code Playgroud)

twitter android twitter-fabric

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

布局xml中具有自定义视图的空指针异常

这是自定义视图代码,它在使用此视图的XML的布局选项卡中为我提供了空指针异常:

public class BoardView extends View {

    // Drawables for the board boxes, the playable zone
    public Drawable[][] block = new Drawable[20][10];
    // Drawables for the wall (yes, it's done with tiles)
    public Drawable[] wall = new Drawable[102];
    // Drawable for the background, and boolean for drawing it or not
    Drawable mbg;
    boolean bg = false;
    // Context and canvas to be used along the class
    Context context;
    Canvas c;

    /*************************************************/
    /* Class constructor **************************** */
    /*************************************************/
    /* Defines the …
Run Code Online (Sandbox Code Playgroud)

java eclipse android custom-view android-custom-view

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

动态引用使用ref回调方法

您如何设置动态参考?我得到一个错误cannot set property of 'test' undefined,如果我使用

<View ref={(ref) => this.someRef['test'] = ref;}/>
Run Code Online (Sandbox Code Playgroud)

react-native

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

Proguard应用程序崩溃(引起:java.lang.NoSuchFieldError:no"Lcom/facebook/jni/HybridData")

当我在发布版本上使用proguard时,我遇到致命的异常.

Caused by: java.lang.NoSuchFieldError: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class "Lcom/facebook/react/cxxbridge/CatalystInstanceImpl;" or its superclasses

这是堆栈跟踪:

03-17 07:06:58.852  1057  1432 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myApp.staging/com.myApp.MainActivity (has extras)} from uid 10008 on display 0
03-17 07:06:58.867  1057  1451 I ActivityManager: Start proc 2234:com.myApp.staging/u0a62 for activity com.myApp.staging/com.myApp.MainActivity
03-17 07:06:58.892  2234  2234 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
03-17 07:06:58.894  2234  2234 W InstanceID/Rpc: Failed to resolve REGISTER intent, falling back
03-17 07:06:58.895  2234  2234 W InstanceID/Rpc: Both Google …
Run Code Online (Sandbox Code Playgroud)

proguard react-native

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

调度返回承诺

这是我的行动:

export function fetchNearbyUsers(user, position) {
  return (dispatch) => {
    const query = new Parse.Query(Parse.User);
    query.withinKilometers('location', createGeoPoint(position), 10);
    query.equalTo('gender', user.attributes.interest);
    query.notEqualTo('objectId', user.id);
    query.limit(15);
    return query.find().then((users) => {
      dispatch({ type: GET_NEARBYUSER_LIST, payload: users });
      return Promise.resolve();
    }).catch((error) => {

    });
  };
}
Run Code Online (Sandbox Code Playgroud)

现在的问题是,当我通过连接映射我的调度时,为什么会返回未定义。

this.props.fetchNearbyUsers(this.props.user, this.props.location).then(() => {
  this.setState({ refreshing: false });
}).catch((error) => {

});

const mapDispatchToProps = dispatch => ({
  fetchNearbyUsers: (user, position) => {
    dispatch(fetchNearbyUsers(user, position));
  },
});
Run Code Online (Sandbox Code Playgroud)

当我通过上下文访问商店时,这会返回 Promise:

const { dispatch } = this.context.store;
this.setState({ refreshing: true …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs redux redux-thunk

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

从堆栈中清除启动器活动

在我的应用程序中,我有活动 A(启动器/主活动)、B、C。A 根据用户是否通过身份验证启动 B 或 C。

现在我如何删除 A 以便在按下后退按钮时它只是退出应用程序,而不是 A。设置标志FLAG_ACTIVITY_CLEAR_TOP似乎不起作用。

@Override
public void onBackPressed{
    super.onBackPressed();
    finish(); // finish activity B or C

    //also finish activity A
}
Run Code Online (Sandbox Code Playgroud)

android

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

lodash uniqWith与一组对象

我有一系列的对象,如:

[{id: '123', name: 'John', someKey:'1234'}, {id: '123', name: 'John', someKey:'12345'}]

这只是一个基本的例子,数据要复杂得多,所以_.isEqual不起作用.

我该如何处理比较器?我想比较id它们是否相等.

_.uniqWith(myArray, function(something) {return something})

lodash

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

等效于 firebase 中的 swift 代码到目标 c

当您只有一个目标时,Firebase 建议使用它来支持多个环境。不过,这是 swift ,因为 react-native 中的 appledelegate.m 不使用 swift ,所以在目标 c 上会是什么。

let filePath = Bundle.main.path(forResource: "MyGoogleService", ofType: "plist")
guard let fileopts = FIROptions.init(contentsOfFile: filePath)
  else { assert(false, "Couldn't load config file") }
FIRApp.configure(with: fileopts)
Run Code Online (Sandbox Code Playgroud)

objective-c ios swift react-native

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