小编Pau*_*uiz的帖子

Android:仅在发布版本中投放SDK v3崩溃

每当我尝试运行我的应用程序的发布版本时,我会在尝试使用任何Google Cast功能时立即崩溃

java.lang.IllegalStateException: Failed to initialize CastContext.

Caused by: java.lang.IllegalAccessException: java.lang.Class<editpackagename.utils.CastOptionsProvider> is not accessible from java.lang.Class<com.google.android.gms.cast.framework.CastContext>
                                                   at java.lang.Class.newInstance(Native Method)
                                                   at com.google.android.gms.cast.framework.CastContext.zzbd(Unknown Source) 
                                                   at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source) 
                                                   at editpackagename.activities.MainActivity.onCreate(MainActivity.java:52) 
Run Code Online (Sandbox Code Playgroud)

一旦我在MainActivity中调用它,就会发生这种崩溃:

CastContext castContext = CastContext.getSharedInstance(this);
Run Code Online (Sandbox Code Playgroud)

如果我运行调试版本,一切都按预期工作.使用Play Services cast-framework 9.4.0.

android google-cast

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

在C/UNIX中创建子进程/终止进程

所以今天我一直在努力,我很确定我很接近,但我仍然对如何终止子进程以及我是否正确地执行此任务感到困惑.这是问题描述:

Write a UNIX program that creates a child process that 
prints a greeting, sleeps for 20 seconds, then exits.
The parent process should print a greeting before creating 
the child, and another after the child has terminated. It 
should then terminate.
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>


int main()
{
    int child;

    printf("Parent Greeting\n");
    child = fork();
    if(child >= 0)
    {
        if(child == 0)
        {
            printf("Child process\n");
            sleep(2);
            printf("Child exiting\n");
            exit(0);
        }
    }
    else
    {
        printf("Failed\n");
    }
    printf("End"); …
Run Code Online (Sandbox Code Playgroud)

c unix operating-system process

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

iOS:向BLE特性添加数据,抛出错误,要求提供只读特性

我有一个广告并可以连接的iOS BLE服务,但现在我想为外设添加一个特性.我想我只是在value属性中添加一个新的NSData对象来创建特性,但每当我在外设管理器上调用addService时,我都会收到此错误:

2015-09-24 09:02:59.456 peripheral[459:27589] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Characteristics with cached values must be read-only'
Run Code Online (Sandbox Code Playgroud)

我添加特征的方法如下所示:

- (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral{
    if (peripheral.state == CBPeripheralManagerStatePoweredOn) {
        _shareService = [[CBMutableService alloc] initWithType:_serviceUUID primary:YES];
        _notifyUUID = [CBUUID UUIDWithString:@"F098FDEF-B82C-43F1-8BFB-18757743BA10"];
        _notificationCharacteristic = [[CBMutableCharacteristic alloc] initWithType:_notifyUUID
                                                                         properties:CBCharacteristicPropertyNotify
                                                                              value:[@"Some Data" dataUsingEncoding:NSUTF16StringEncoding]
                                                                        permissions:CBAttributePermissionsReadable];

        [_shareService setCharacteristics:@[_notificationCharacteristic]];

        [_pMgr addService:_shareService];

        [self startAdvertising];

    }
}
Run Code Online (Sandbox Code Playgroud)

虽然当我将值项更改为nil时,它再次广告正常.我确信我有一些简单的东西,但我仍然相当熟悉iOS,所以任何帮助都会很棒.谢谢!

objective-c ios bluetooth-lowenergy

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

从自定义ListView Android中删除行

好的,所以我在SO上搜索了一下,但似乎无法得到工作的答案.这个是关闭的,但它会删除列表中的最后一项,然后在删除最后一个值时崩溃.我只想让列表行内的按钮根据列表中的内容执行操作,然后从列表中删除该行.谢谢!

public class CitrusListAdapter extends ArrayAdapter<CitrusList>
{

//Globals
Context context;
int layoutResourceId;
ArrayList<CitrusList> data = null;

//Create the list item row
public CitrusListAdapter(Context context, int layoutResourceId, ArrayList<CitrusList> listItems)
{
    super(context, layoutResourceId, listItems);
    this.layoutResourceId = layoutResourceId;
    this.context = context;
    this.data = listItems;
}

//Expand and place items for List View onto calling page in ListView
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
    View row = convertView;
    CitrusListHolder holder = null;

    if(row == null)
    {
        LayoutInflater inflater = …
Run Code Online (Sandbox Code Playgroud)

android listview adapter

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

打包Android Wear应用程序

有人知道是否有可用于打包可穿戴应用程序的文档?"打包可穿戴应用程序"链接在http://developer.android.com/training/wearables/apps/creating.html中打印错误

http://developer.android.com/traiing/wearables/packaging.html

甚至http://developer.android.com/training/wearables/packaging.html都是404.

该应用程序已编写,我可以直接安装到Samsung Gear Live,因此希望将应用程序安装到Play商店.

android wear-os

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