小编Dev*_*gur的帖子

如何使用openfire实现第三方GCM-CCS XMPP服务器?

目前我正在研究即时消息聊天应用程序,其中我需要实现第三方聊天服务器.

我正在学习本教程

在Github上提供完整的项目在这里.

当我下载这个项目时,它为我提供了两个项目文件夹; 第一个是GCMDemo,第二个是GCM_CCS_application.

我在eclipse中导入GCMDemo; 它为我提供了一个用于发送消息的GCM客户端,它工作正常.

但我不知道如何使用GCM_CCS_application.这是一个java应用程序.GSM_CCS_application不是Android应用程序; 它适用于服务器端应用程序.

我的计算机上安装了openfire服务器,但不知道如何在这个应用程序中使用openfire.所以请有人告诉我如何实现这个服务器端应用程序.

android xmpp openfire google-cloud-messaging

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

使用setCompoundDrawablesWithIntrinsicBounds()时如何设置图像大小?

我需要在选项卡布局中的选项卡中将图像设置在文本上方.所以我在TextView使用setCompoundDrawablesWithIntrinsicBounds 设置图像,但我不知道如何给我的图像大小.

我试着给这样大小:

Drawable dr = ContextCompat.getDrawable(MainActivity.this, R.drawable.mobile_icon);
    Bitmap bitmap = ((BitmapDrawable) dr).getBitmap();
    mobile_drawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(bitmap, 50, 50, true));

    TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabOne.setText("Mobile");
    tabOne.setCompoundDrawablesWithIntrinsicBounds(0,mobile_drawable,0,0);
    tabLayout.getTabAt(0).setCustomView(tabOne);
Run Code Online (Sandbox Code Playgroud)

但它给了我这个错误:

Cannot resolve method setCompoundDrawablesWithIntrinsicBounds(int,android.graphics.drawable.Drawable,int,int);
Run Code Online (Sandbox Code Playgroud)

我也试过了

tabOne.setCompoundDrawables(0,mobile_drawable,0,0);
Run Code Online (Sandbox Code Playgroud)

但它也不起作用?

那么在使用setCompoundDrawablesWithIntrinsicBounds时如何给出图像大小?

android bitmap android-drawable

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

如何从谷歌地图获得下一个转折点 - (Android)

目前我正在开发一个应用程序,我需要获取下一个转折点的位置而不打开手机上的任何地图,然后我需要将此位置存储在字符串数组或Hashmap上.


示例:假设我需要从孟买市前往德里市.当我运行我的应用程序时,它要求两个位置source locationdestination location在文本框中,并以文本形式向我提供按钮单击的信息,如下所示: -

您在这里current location------>从左转turning point location---- - >右转next turning location---->你到达了destination location.

注意 - 用户不会移动任何地方,他/她从按钮点击的文本中获取此信息.所以我需要找到路线的转折点(左转和右转).

我无法在互联网上找到解决方案.

那我怎么能这样做呢.有人可以发布工作示例或给我一个相关示例的链接.谢谢你的帮助.

android google-maps geolocation google-maps-api-3

5
推荐指数
0
解决办法
1055
查看次数

#define如何工作?CUBE(y)y*(y*y)的奇怪结果

#include<stdio.h>
#include<conio.h>
#define CUBE(y)y*(y*y)
 main()
      {
        int j;
        j = CUBE(-2+4);
        printf("value of j = %d",j);
        getch();
      }
Run Code Online (Sandbox Code Playgroud)

此代码的输出是-26.我只是想知道这段代码如何-26作为输出.如何#define在这段代码中工作.我知道#define变量或方法的永久修复值,但不知道这是如何工作的CUBE.有人可以一步一步地描述这个,简单的方法.

c c-preprocessor

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

包括一个新的布局,里面 CoordinatorLayout 不能正常工作?

我有两种布局。第一个布局文件名是home.xml,第二个名称是coordinator.xml. 所以我只想包含home.xml在 coordinator.xml 中。但问题是当我尝试将此布局包含在 中时coordinator.xml,它会穿过移动屏幕并进入其中。

如果我包含app:layout_behavior="@string/appbar_scrolling_view_behavior"在我的包含布局中,它会穿过移动屏幕并进入其中。

如果我不包含此行为,它会与Toolbar.

那么解决方案是什么?

home.xml 代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World"/>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:id="@+id/view"
        android:layout_above="@+id/linear1"
        android:background="#00409f"
        android:layout_marginBottom="10dp"
        />

    <LinearLayout
        android:layout_width="match_parent"
        android:id="@+id/linear1"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_weight="1"
            android:layout_width="0dp"
            android:orientation="vertical"
            android:gravity="center"
            android:layout_height="wrap_content">

            <ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:src="@drawable/home"/>
            <TextView
                android:layout_width="wrap_content"
                android:textColor="#000000"
                android:layout_height="wrap_content"
                android:text="Home"/>

        </LinearLayout>

        <LinearLayout
            android:layout_weight="1"
            android:layout_width="0dp"
            android:orientation="vertical"
            android:gravity="center"
            android:layout_height="wrap_content">

            <ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:src="@drawable/wallet"/>
            <TextView
                android:layout_width="wrap_content"
                android:textColor="#000000"
                android:layout_height="wrap_content"
                android:text="Wallet"/>

        </LinearLayout> …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-toolbar android-coordinatorlayout

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

二进制XML文件行#10:错误膨胀类片段

在我的项目中,我使用三个选项卡在单个屏幕中显示三个活动.选项卡1 - 地图
选项卡2 - 游戏
选项卡3 - Imageflipper
当我选择系列中的选项卡,如地图--->游戏---> Imageflipper然后它工作正常.
但当我选择回到任何选项卡,如地图--->游戏---> Imageflipper --- >>游戏,然后它显示错误 -
二进制XML文件行#10:错误膨胀类片段.

模拟器的屏幕截图:

http://s9.postimg.org/jdjsxnswf/Untitled.png


这是我的logcat.

03-26 05:48:09.876: D/AndroidRuntime(1094): Shutting down VM
03-26 05:48:09.876: W/dalvikvm(1094): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
03-26 05:48:09.936: E/AndroidRuntime(1094): FATAL EXCEPTION: main
03-26 05:48:09.936: E/AndroidRuntime(1094): android.view.InflateException: Binary XML file line #10: Error inflating class fragment
03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.example.image_changer.TopRatedFragment.onCreateView(TopRatedFragment.java:15) …
Run Code Online (Sandbox Code Playgroud)

xml android android-fragments

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