小编Jes*_*sse的帖子

iOS文字转语音Api

我似乎无法找到任何相关的东西.在iOS7中是否有任何Siri类或API可以让您进行文本到语音转换?我想要做的就是以下内容:

[siriInstance say:@"This is a test"];
Run Code Online (Sandbox Code Playgroud)

然后让Siri从我的应用程序中说出来.

看来我们应该有能力做到这一点,不是吗?看起来像是一件微不足道的事情.

text-to-speech ios siri

50
推荐指数
2
解决办法
4万
查看次数

Android上的ProGuard和Gson(ClassCastException)

我和Gson和ProGuard度过了一段难忘的时光.我有一个简单的对象,当我解析tojson时,保存到sqllite并从数据库读回以便将json加载回我的对象​​,我得到一个java.lang.classcastexception.如果我不使用ProGuard,everthing工作正常.

我已经验证了发送到数据库并从数据库获取的json字符串是相同的.从json转换时不会抛出异常,而是在我尝试访问对象时抛出异常.

这是我的简单对象:

public class ScanLog extends ArrayList<SingleFrame>
{
     private static final long serialVersionUID = 1L;

     public ScanLog()
     {

     }
}

public final class SingleFrame 
{
    public int Position;
    public int Time;
    public Map<Integer,String> MainDataMap;
    public Map<Integer,String> DataMap;

    public SingleFrame(int position, int time, 
                    Map<Integer,String> mainDataMap, Map<Integer,String> dataMap)
    {
        this.Position = position;
        this.Time = time;
        this.MainDataMap = mainDataMap;
        this.DataMap = dataMap;
    }

}
Run Code Online (Sandbox Code Playgroud)

我的应用程序的所有其他方面都很好,但使用proguard导致这种情况发生....我已经在proguard.cfg中尝试了各种-keep命令,但我不确定我做的是对的.

编辑 - 添加PROGUARD.CFG

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-dontshrink
-dontoptimize

-keep public class * extends android.app.Activity
-keep public …
Run Code Online (Sandbox Code Playgroud)

android proguard gson

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

如何使用HttpClient发布身份验证

我正在尝试使用HttpClient在C#中执行以下curl(适用于我).

curl -X POST http://www.somehosturl.com \
     -u <client-id>:<client-secret> \
     -d 'grant_type=password' \
     -d 'username=<email>' \
     -d 'password=<password>' \
     -d 'scope=all
Run Code Online (Sandbox Code Playgroud)

C#代码:

HttpClientHandler handler = new HttpClientHandler { Credentials = new  
            System.Net.NetworkCredential ("my_client_id", "my_client_secret")
    };


    try
    {
        using(var httpClient = new HttpClient(handler))
        {
            var activationUrl = "www.somehosturl.com";

            var postData = "grant_type=password&username=myemail@myemail.com&password=mypass&scope=all";
            var content = new StringContent(postData, Encoding.UTF8, "application/x-www-form-urlencoded");

            var response = await httpClient.PostAsync(activationUrl, content);
            if(!response.IsSuccessStatusCode)
                return null;

            var result = await response.Content.ReadAsStringAsync();

            return result;
        }
    }
    catch(Exception)
    {
        return null;
    } …
Run Code Online (Sandbox Code Playgroud)

.net c# httpclient

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

Android Eclipse无法调试

我的应用程序的调试现在突然中断了.它一直很好,我甚至重新加载了我的整个代码的已知良好版本,它仍然无法调试甚至运行.当我点击调试或运行应用程序启动时,即将显示应用程序,它崩溃(甚至进入主视图之前).我在第一行代码上有一个断点,它甚至都没有达到它.它只是找不到源 - 源附件不包含文件DexFile.class的源.....我100%确定我加载的所有代码都正常工作,因为它是保存的备份已保存什么时候上班.

另外,奇怪的是,如果我此时拔下电缆,应用程序正常加载并正常工作.所以这绝对是一个调试问题.它在开机时被卡住了.我重新启动了我的电脑和手机几次无济于事.

LogCat:
`04-04 11:17:33.462: DEBUG/AndroidRuntime(4148): CheckJNI is OFF
04-04 11:17:33.462: DEBUG/dalvikvm(4148): creating instr width table
04-04 11:17:33.502: DEBUG/AndroidRuntime(4148): --- registering native functions ---
04-04 11:17:33.712: DEBUG/AndroidRuntime(4148): Shutting down VM
04-04 11:17:33.712: DEBUG/dalvikvm(4148): Debugger has detached; object registry had 1 entries
04-04 11:17:33.712: INFO/AndroidRuntime(4148): NOTE: attach of thread 'Binder Thread #3' failed
04-04 11:17:33.902: DEBUG/AndroidRuntime(4157): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
04-04 11:17:33.902: DEBUG/AndroidRuntime(4157): CheckJNI is OFF
04-04 11:17:33.902: DEBUG/dalvikvm(4157): creating instr width table
04-04 11:17:33.942: DEBUG/AndroidRuntime(4157): --- registering native …
Run Code Online (Sandbox Code Playgroud)

eclipse debugging android

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

Android在Style中设置ImageView图像src

我需要在我的风格中设置ImageView的src,但我找不到任何人这样做的好例子,当我尝试下面的代码时,它会崩溃应用程序.

<ImageView android:src="@style/TitleBarImage"></ImageView>

<style name="TitleBarImage">     
    <item name="android:layout_width">wrap_content</item>     
    <item name="android:layout_height">wrap_content</item>     
    <item name="android:src">@drawable/whiteButton</item> 
</style> 
Run Code Online (Sandbox Code Playgroud)

这应该很简单.是什么赋予了?

android coding-style imageview

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

iOS UITableView reloadRowsAtIndexPaths

我有一个UITableview,懒惰加载所有不同大小的图像.加载图像时,我需要更新特定的单元格,所以我想出了我需要使用reloadRowsAtIndexPaths.但是当我使用这个方法时,它仍然为每个单元格调用heightForRowAtIndexPath方法.我认为reloadRowsAtIndexPaths的全部目的是它只会为你指定的特定行调用heightForRowAtIndexPath?

知道为什么吗?

[self.messageTableView beginUpdates];
[self.messageTableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:count inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
[self.messageTableView endUpdates];
Run Code Online (Sandbox Code Playgroud)

谢谢

uitableview ios

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

Android Proguard问题

使用proguard似乎很混乱.我有兴趣简单地在我的应用程序中混淆一些软件包.我在windows中使用最新的Android API设置了eclipse.我添加了默认的proguard.cfg来构建我的应用程序没有问题,但是当我运行应用程序时,应用程序的某些功能不再起作用.它只是奇怪的东西.

此外,每当我创建一个新项目时,它永远不会自动创建proguard.cfg,我不知道为什么.但我可以找到它

android-sdk-windows\tools\lib
Run Code Online (Sandbox Code Playgroud)

我真正感兴趣的是在我的代码中混淆某些包甚至几个类.如果我能做到这一点,我会非常满意.有没有简单的方法来说"混淆这个".你们可以分享的任何基本配置?

android proguard

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

Android LinearGradient 预分配和重用

我一直在更新一个应用程序中的一些旧代码,该应用程序在 onDraw 中有很多重新分配并抱怨消息:

Avoid object allocations during draw/layout operations (preallocate and reuse instead).
Run Code Online (Sandbox Code Playgroud)

所以我已经正确更新了所有内容,没有更多警告,除了一个。线性梯度。似乎没有方法可以在对象的实例上设置值。而且属性不是公开的,所以你不能做 linLayout.x = value;

这是我的代码,它抱怨上述警告(在 LinearGradient 下划线):

myPaintGradient.setShader(new LinearGradient(deviation,6,halfwidth,LinearGradientSize,barColorGreen, barColorRed, android.graphics.Shader.TileMode.CLAMP));
Run Code Online (Sandbox Code Playgroud)

android linear-gradients

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

iOS 8共享扩展Safari图像

我在iOS 8应用程序中设置了一个共享扩展程序,一切正常.我可以从Photo app或Safari分享.但是当我在Safari中时,我不知道如何获取生成的网页缩略图.我已经注册了适当的NSExtensionActivationRule.当我从Photo应用程序共享照片时,NSItemProvider对象类型说它是public.jpeg并且我能够使用

[itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(UIImage *image, NSError *error)
{
         [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil];
}];
Run Code Online (Sandbox Code Playgroud)

为了获得图像

但是当我从Safari共享时,NSItemProvider类型说它是public.url,我不知道如何获取图像?我知道如何获取url,通过执行loadItemForTypeIdentifier:@"public.url"但是如何获取图像?

safari ios

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

TableLayout中的Android EditText运行

我在tablelayout中有一个简单的符号,但里面的内容向右伸展得太远了.在我看来,一切都集中在一起.或者似乎EditText试图将自己置于主要父级内部,而不是IT父级tablelayout.知道为什么吗?

<?xml version="1.0" encoding="UTF-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bluebg"
android:id="@+id/loading_page_lin_layout"
>
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/roundtable"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_margin="10dip"
        android:padding="10dip"
        android:stretchColumns="*">
        <TableRow>
            <EditText  
            android:id="@+id/txtUserName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textColor="#85AFBE"                              
            android:hint="Email"
            android:text=""
            android:gravity="left"

            />
         </TableRow>
        <TableRow>
            <EditText  
                android:id="@+id/txtPassword"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#85AFBE"                              
                android:text=""
                android:hint="Password"
                android:password="true"
                android:gravity="left"  
                android:layout_gravity="center"                     
                />
        </TableRow>
        <TableRow>
            <!--  <Button
            android:id="@+id/btnSignIn"
            android:text="Sign In" 
            android:layout_width="fill_parent"
            android:paddingTop="10dip"
            android:gravity="center"
            />-->
            <ImageButton 
             android:id="@+id/btnSignIn"
             android:src="@drawable/signbig"    
             android:scaleType="fitCenter"   
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"                
             android:adjustViewBounds="true"
             android:layout_marginLeft="3dip"
             android:background="@null"
             android:layout_marginRight="3dip"
             android:layout_gravity="center"
             />
        </TableRow>
        <TableRow>
            <Button
            android:id="@+id/btnSignUp"
            android:background="@null"
            android:text="Sign Up" 
            android:textStyle=""
            android:layout_width="wrap_content"
            android:paddingTop="10dip"
            android:textSize="20dip"
            android:gravity="center" …
Run Code Online (Sandbox Code Playgroud)

android tablelayout android-edittext

4
推荐指数
2
解决办法
5674
查看次数

UITableView indexPathsForVisibleRows返回错误的行

在我的iOS 7应用程序中,我的视图设置为"在顶栏下方延伸边缘",因此当您向下滚动时,当您在导航栏下滚动时,我的uitableview具有半透明效果.但是当您向后滚动到顶部或加载时,它会将第一个单元格正确定位在导航栏下方,而不是位于导航栏下方.

问题是,indexPathsForVisibleRows看到导航栏下面的单元格.因此,例如,如果我们向下滚动以便我们看到的是单元格索引1(第二个单元格),单元格索引0位于导航栏下方,当我们调用indexPathsForVisibleRows时,它返回索引0而不是索引1作为最低单元格是可见的.

还有其他方法吗?

uitableview ios

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

解析SDK Android Proguard问题

我在我的应用程序中解析了1.5.1并且一切正常,但是当我导出到APK时,我得到:

[2014-09-05 19:53:08 - myapp] Proguard returned with error code 1. See console
[2014-09-05 19:53:08 - myapp] Note: there were 662 duplicate class definitions.
[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider$1: can't find superclass or interface com.facebook.android.Facebook$ServiceListener
[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider$2: can't find superclass or interface com.facebook.Session$StatusCallback
[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider$2$1: can't find superclass or interface com.facebook.Request$Callback
[2014-09-05 19:53:08 - myapp] Warning: com.parse.FacebookAuthenticationProvider: can't find referenced class com.facebook.android.Facebook
......
[2014-09-05 19:53:08 - myapp]   at proguard.Initializer.execute(Initializer.java:321)
[2014-09-05 19:53:08 …
Run Code Online (Sandbox Code Playgroud)

android proguard parse-platform

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

Node.js + Firebase orderByChild无效

我试图弄清楚这个嵌套的排序,我做的任何事都不会起作用.

以下是我尝试订购的数据结构示例:

{
  "-KV_Lrm_93Agm8kAuXql": {
    "body": {
      "Acceleration": "0.0",
      "Altitude": "11",
      "Battery": "12.7",
      "Date": "2016/09/10",
      "order": 1,
      "time": "2016-10-19T20:26:32Z"
    }
  },
  "-KV_LuTfJ9VrKRHoRWuw": {
    "body": {
      "Acceleration": "0.0",
      "Altitude": "11",
      "Battery": "12.7",
      "Date": "2016/09/10",
      "order": 5,
      "time": "2016-10-21T20:26:32Z"
    }
  },
  "-KV_Lx9VABuEB8D3I-i1": {
    "body": {
      "Acceleration": "0.0",
      "Altitude": "11",
      "Battery": "12.7",
      "Date": "2016/09/10",
      "order": 2,
      "time": "2016-10-01T20:26:32Z"
    }
  },
  "-KV_LzQOM3rHEKQuwyHQ": {
    "body": {
      "Acceleration": "0.0",
      "Altitude": "11",
      "Battery": "12.7",
      "Date": "2016/09/10",
      "order": 10,
      "time": "2016-09-01T20:26:32Z"
    }
  },
  "-KV_M0fdznAbKanHoY91": {
    "body": {
      "Acceleration": …
Run Code Online (Sandbox Code Playgroud)

node.js firebase firebase-realtime-database

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