小编Mis*_*pov的帖子

Room - Schema导出目录未提供给注释处理器,因此我们无法导出架构

我正在使用Android数据库组件室

我已经配置了所有内容,但是当我编译时,Android Studio会给我这个警告:

模式导出目录未提供给注释处理器,因此我们无法导出模式.您可以提供 room.schemaLocation注释处理器参数或将exportSchema设置为false.

据我所知,它是DB文件所在的位置

它怎么会影响我的应用程序?这里的最佳做法是什么?我应该使用默认位置(false值)吗?

java database android android-room

310
推荐指数
10
解决办法
8万
查看次数

crashlytics android studio gradle build失败

我已经安装了crashlytics插件到android studio 0.9.3; 在此之后我加入了我的项目; 它增加了线条,第一活动等......; 此构建失败后出现此错误:

错误:任务':app:fabricCleanupResourcesDebug'的执行失败.

Crashlytics开发人员工具错误.

在此输入图像描述

这是我的gradle文件,我应该更改什么?Crashlytics自动添加了它的行:

buildscript {
  repositories {
    maven {
      url 'https://maven.fabric.io/public'
    }
  }

  dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
  }
}
apply plugin : 'com.android.application' apply plugin : 'io.fabric'

repositories {
  maven {
    url 'https://maven.fabric.io/public'
  }
}

android {
  compileSdkVersion 21
  buildToolsVersion "21.0.2"

  defaultConfig {
    applicationId "XXXXXXXXXXXXXXXXXXXXXXX"
    minSdkVersion 11
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
  }
  buildTypes {
    release {
      runProguard false
      proguardFiles getDefaultProguardFile('proguard-android.txt'),
      'proguard-rules.pro'
    }

  }
}

dependencies {
  compile fileTree(dir : 'libs', include : …
Run Code Online (Sandbox Code Playgroud)

android build gradle crashlytics android-studio

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

Android以编程方式创建SIP帐户

在我的应用程序中,我希望有一个Activity,使用户能够在字段中添加他的SIP帐户参数.我不希望他们去设置 - >呼叫 - >互联网呼叫设置 - >添加帐户 - >添加

我使用以下代码创建了包含活动的帐户:

SipManager mSipManager = null;

    if(mSipManager == null) {
        mSipManager = SipManager.newInstance(this);
    }

    android.provider.Settings.System.putInt(context.getContentResolver(), android.provider.Settings.System.s , 0)
    SipProfile mSipProfile = null;
    SipManager manager = SipManager.newInstance(getBaseContext());

    SipProfile.Builder builder;
    try {
        builder = new SipProfile.Builder("XXXXX", "sip.linphone.org");
        builder.setPassword("XXX");
        mSipProfile = builder.build();
        manager.open(mSipProfile);
        //manager.register(mSipProfile, 30, MyActivity.this);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
Run Code Online (Sandbox Code Playgroud)

但该帐户绑定到应用程序,当我删除应用程序时,它会删除该帐户.我希望它独立于应用程序.

account settings android add sip

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

Spring JPA没有交易正在进行中

我是Spring和JPA的新手,浪费了5天,搜索互联网没有结果.我想将对象保存到SQL SERVER,连接是正确的但是当我写.flush()时我得到了异常

嵌套异常是javax.persistence.TransactionRequiredException:没有事务正在进行中

这是我的jpaContext.xml

     <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">

<context:annotation-config />
<context:component-scan base-package="com.misha.service"/>
<context:component-scan base-package="com.misha.repository"/>
<context:component-scan base-package="com.misha.model"/>

<bean
    class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

<bean id="myEntityManager"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="com.misha.model"/>
    <property name="persistenceUnitName" value="test" /> 
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
    </property>
    <property name="jpaProperties">
        <props>
            <prop key="hibernate.format_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">create</prop>
            <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
        </props>
    </property>
</bean>
<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
    <property name="url"
        value="jdbc:jtds:sqlserver://127.0.0.1;instance=SQLEXPRESS;DatabaseName=misha" />
    <property name="username" value="sa" />
    <property name="password" value="root" /> …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa spring-mvc

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

导航抽屉Android上的底部布局

尝试将页脚添加到包含两个列表的导航抽屉中.我没有这样做,我明白我想要的任何东西都应该封装在导航抽屉里

<LinearLayout
            android:id="@+id/left_drawer_layout"
Run Code Online (Sandbox Code Playgroud)

我想添加一个不依赖于ListView滚动的底部布局.我尝试了不同版本的地方添加底部布局代码但没有任何反应.我需要额外的眼睛.谢谢.

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar”/>



        <!-- Framelayout to display Fragments -->

        <FrameLayout
            android:id="@+id/frame_container"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

    </LinearLayout>


    <!-- Listview to display slider menu -->

    <LinearLayout
        android:id="@+id/left_drawer_layout"
        android:layout_width="@dimen/navigation_drawer_max_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:orientation="vertical">


        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:background="@color/list_background">

            <Button
                android:id="@+id/refreshBtn"
                android:layout_width="match_parent"
                android:layout_height="48dp"
                android:text="@string/refresh"
                android:visibility="gone" />

            <EditText
                android:id="@+id/searchMenuTxt"
                android:layout_width="match_parent"
                android:layout_height="48dp"
                android:background="@color/list_background_pressed"
                android:drawableLeft="@drawable/search_web"
                android:drawablePadding="@dimen/activity_horizontal_margin"
                android:drawableStart="@drawable/search_web"
                android:focusable="false"
                android:focusableInTouchMode="true"
                android:hint="@string/search"
                android:paddingLeft="8dp"
                android:singleLine="true"
                android:textColorHint="@android:color/darker_gray"
                android:textSize="@dimen/text_size_14"></EditText>

            <Button
                android:id="@+id/clearBtn"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_gravity="right|center"
                android:background="@drawable/mob_clear"
                android:paddingRight="8dp"
                android:visibility="invisible" />

        </FrameLayout>

        <LinearLayout …
Run Code Online (Sandbox Code Playgroud)

android android-layout

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

在 Visual Studio Code 中设置 isDevelopment 时

我想使用快捷键重新加载窗口,它已经定义为ctrl+R

在此处输入图片说明

但不知道如何使用快捷键重新加载窗口。

你能解释一下我如何处于 isDevelopment 状态吗?

谢谢

shortcut visual-studio-code

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

RecyclerView拖动第一个项目时,它跳到底部

我正在使用 ItemTouchHelper 在 RecyclerView 中使用 \xe2\x80\x9cdrag & drop\xe2\x80\x9d 和 \xe2\x80\x9cswipe-to-dismiss\xe2\x80\x9d 。没有任何库,根据本教程。它工作正常。\n但是当 RecyclerView 中有滚动时就会出现问题。当我开始向下拖动第一个项目时,第一个和第二个元素交换位置,RecyclerView 向上滚动,第一个元素(我拖动的)出现在最后一个元素之前的底部(由于 RecyclerView 滚动而发生许多滑动)。它发生得非常快,所以我无法将第一个元素放在我想要的任何地方。

\n\n

请注意,它仅发生在第一个元素上,也仅在向下拖动时发生。

\n\n

我认为发生这种情况是因为当第二个元素转到位置 1 时,第三个元素转到第二个位置并且也与第一个元素一起滑动,与其他元素相同,它们都与第一个元素一起滑动。我怎样才能解决这个问题。

\n\n

这就是当第一个项目与第二个项目改变位置时所称的情况(以及项目交换位置时的任何拖动)。一次交换后,一项就完成了:

\n\n
    @Override\n    public void onItemMove(int fromPosition, int toPosition) {\n        if (fromPosition < toPosition) {\n            for (int i = fromPosition; i < toPosition; i++) {\n                Collections.swap(categories, i, i + 1);\n            }\n        } else {\n            for (int i = fromPosition; …
Run Code Online (Sandbox Code Playgroud)

android scroll drag android-recyclerview

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

数据库更改Android时收到通知

我有一个SQL Server数据库,当表中有插入时,我想通知Android应用程序.

例如,当订单收到时,我将其插入SQL Server数据库.我还希望用户在我的应用程序中获得有关订单的通知.该应用程序始终打开.我使用Web服务与数据库联系.

我不想每10秒钟左右请一次这张桌子.还有其他方法吗?

sql database sql-server notifications android

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

Android 推送通知(慢)

我有 IIS 服务器并使用 GoogleCloudMessaging 向手机发送通知。在安卓设备上接收消息大约需要 10 分钟。我的项目时间很长。你知道如何减少时间吗?

那是服务器 C# 代码(使用 PushSharp)

var push = new PushBroker();

        //Wire up the events for all the services that the broker registers
        /*NotificationSent s = new NotificationSent()
        push.OnNotificationSent += "NotificationSent";
        push.OnChannelException += "ChannelException";
        push.OnServiceException += "ServiceException";
        push.OnNotificationFailed += "NotificationFailed";
        push.OnDeviceSubscriptionExpired += "DeviceSubscriptionExpired";
        push.OnDeviceSubscriptionChanged += "DeviceSubscriptionChanged";
        push.OnChannelCreated += "ChannelCreated";
        push.OnChannelDestroyed += "ChannelDestroyed";
        */

        push.RegisterGcmService(new GcmPushChannelSettings("MY API KEY"));

        push.QueueNotification(new GcmNotification().
            ForDeviceRegistrationId("PHONE REGISTRATION ID")
                              .WithJson(@"{""alert"":""Name !"",""badge"":7,""sound"":""sound.caf""}"));


        //Stop and wait for the queues to drains
        push.StopAllServices();
Run Code Online (Sandbox Code Playgroud)

这是我的接收器,

公共类 …

performance time notifications android push-notification

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

如何在离子框架+ angularjs中调用函数?

我正在使用离子框架来制作Android应用程序.我有cordova 5.1版本.首先我使用命令行离子启动myApp标签创建一个项目.我添加了android平台.现在我需要将java代码传递给javascript代码.使用谷歌我发现我需要制作自定义插件.但我没有在谷歌上找到任何解决方案我们将如何创建自定义插件.我发现ng-cordova给出了自己的插件我们无法制作自定义插件.

我只需要UI上的一个按钮.点击该按钮我需要调用java函数打印一些登录控制台.然后返回成功或错误回调JavaScript文件

你能否告诉我如何在离子中创建一个简单的插件?

android phonegap-plugins angularjs cordova ionic-framework

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