小编ina*_*eli的帖子

不使用GCM的Android推送通知

我需要简单的步骤来实现GCM而不使用android的标准方式.相反,我需要设置我自己的中央服务器进行设备注册,并将文件从服务器上传到已注册的设备而不使用GCM.

我还需要一些建议来通过管理控制台阻止某些应用程序(例如:需要选择并向特定设备发送通知以阻止用户启动设备上安装的gmail/Google Play应用程序).它更像是移动应用程序管理的概念.让我对这些提出建议.

android push-notification

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

使用ListFragment填充自定义视图列表

我试图使用片段在列表视图中显示元素.我创建了自定义视图,如下所示

list_row.xml的图形表示

在此输入图像描述

list_row.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="5dip" >

    <!-- ListRow Left sied Thumbnail image -->

    <LinearLayout
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="5dip"
        android:padding="3dip" >

        <ImageView
            android:id="@+id/list_image"
            android:layout_width="50dip"
            android:layout_height="50dip" 
            android:contentDescription="@string/image_desc"/>
    </LinearLayout>

    <!-- Menu name -->

    <TextView
        android:id="@+id/menu_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="@string/menu_name"
        android:textColor="#040404"
        android:textSize="15sp"
        android:textStyle="bold"
        android:typeface="sans" />

    <!-- Description -->

    <TextView
        android:id="@+id/description"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/thumbnail"
        android:layout_below="@id/menu_name"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="@string/description"
        android:textColor="#343434"
        android:textSize="10sp"
        tools:ignore="SmallSp" />

    <!-- Price -->

    <TextView
        android:id="@+id/price"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@id/menu_name"
        android:layout_marginRight="5dip"
        android:gravity="right"
        android:text="@string/price"
        android:textColor="#10bcc9" …
Run Code Online (Sandbox Code Playgroud)

android android-custom-view android-listview android-listfragment

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

客观c浮动值

为什么我们不能将两个整数的除法结果存储到float变量中?

int a = 100;
int b =50;
float temp = b/a;
Run Code Online (Sandbox Code Playgroud)

它给出了t = 0!

我也这样做了

int temp = b/a;
Run Code Online (Sandbox Code Playgroud)

它给出了t = 0!

但是当我这样做的时候

float temp = (float)b / (float)a;
Run Code Online (Sandbox Code Playgroud)

它给出了正确的结果.为什么这样 ?

c objective-c

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

更改pagerTabStrip tabIndicator的高度

android.support.v4.view.PagerTabStrip在我的申请中使用.

这是我使用tabIndicator的方法

PagerTabStrip pagerTabStrip = (PagerTabStrip)
findViewById(R.id.pager_title_strip);
pagerTabStrip.setDrawFullUnderline(true);
pagerTabStrip.setTabIndicatorColor(Color.parseColor("#32CD32"));
Run Code Online (Sandbox Code Playgroud)

我的tabIndicator的高度非常小.如何设置/增加谷歌游戏的高度?

在此输入图像描述

android android-support-library

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

奇怪的iOS UIWebView Crash称为WTF Crash

我在一些屏幕中使用UIWebViews,因为我需要一个完美的Html文本解析.

根据崩溃报告,在这些屏幕上发生了大量的崩溃,称为WTF崩溃.这是一个崩溃的痕迹

Crashed: WebThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000bbadbeef

Thread : Crashed: WebThread
0  JavaScriptCore                 0x184fd2710 WTFCrash + 72
1  JavaScriptCore                 0x184fd2708 WTFCrash + 64
2  WebCore                        0x1852b7d78 <redacted> + 362
3  WebCore                        0x1852b7bec <redacted> + 44
4  CoreFoundation                 0x1817d8588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
5  CoreFoundation                 0x1817d632c __CFRunLoopDoObservers + 372
6  CoreFoundation                 0x1817d6674 __CFRunLoopRun + 696
7  CoreFoundation                 0x181705680 CFRunLoopRunSpecific + 384
8  WebCore                        0x1852b5998 <redacted> + 456
9  libsystem_pthread.dylib        0x18148bb28 <redacted> + 156
10 libsystem_pthread.dylib        0x18148ba8c _pthread_start + 154
11 libsystem_pthread.dylib        0x181489028 …
Run Code Online (Sandbox Code Playgroud)

crash uiwebview ios

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

未找到Android SDK错误

我正在开发一个使用Facebook SDK的Android项目.直到今天一切都很好.当我尝试运行该项目时,它会出现以下错误.

Unable to resolve target 'android-10' until the SDK is loaded
Run Code Online (Sandbox Code Playgroud)

虽然我有SDK 2.3.3(级别10),但它没有出现在项目属性中.在Eclipse的属性中,它说,

This Android SDK requires Android Developer Toolkit version 21.1.0 or above.  Current version is 21.0.0.2012-10-31-0-17.  Please update ADT to the latest version.
Run Code Online (Sandbox Code Playgroud)

但是,根据Android SDK Manager,我已经安装了最新版本(见下图).

在此输入图像描述

我该如何解决这个问题?任何帮助将不胜感激,提前谢谢.

编辑:

我正在使用Mac OSX 10.8,我尝试重启eclipse和os.

eclipse android adt

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

随机数生成器c ++

好吧,我对c ++很新,我试图让随机数生成器工作.一般的想法是每次循环调用随机生成器并将随机数放入数组.它基本上有效,唯一的问题是数量不是随机的.每次打印出来的时间都是-842150451,这是一个问题.

int main()
{
    int *array;
    int size;
    cout << "Enter size of array: ";
    cin >> size;
    array = new int[size];
    for (int x = 0; x < size; x++)
    {
        srand ( time(NULL) );
        int randomNumber;
        randomNumber = rand() % 10000 + 1;
        randomNumber >> array[x];
Run Code Online (Sandbox Code Playgroud)

它是更大的排序算法的一部分,所以我不打扰复制整个事情,因为这是问题的一部分.

c++ random

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