小编Bru*_*ino的帖子

Android:发送短信时的Unicode /字符集问题(sendTextMessage)

基本上我有一个工作的应用程序,收到短信后发送短信.

一切正常,除非要发送的SMS文本有"特殊字符",即"é,à,í,ç"等.

我已经尝试了很多东西,包括charset转换,但我根本无法使它工作... msgText总是带回charset编码问题.

这是发送消息的部分:

if (msgText.length() > 160) {
    ArrayList msgTexts = sm.divideMessage(msgText);
    sm.sendMultipartTextMessage(PhoneNumber, null, msgTexts, null, null);
} else {
    try {
        sm.sendTextMessage(PhoneNumber, null, msgText, null, null);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我尝试的charset转换函数(但没有帮助),我在msgText上应用了:

public static String formatCharset(String txtInicial) {
    //-- Please notice this is just for reference, I tried every charset from/to conversion possibility. Even stupid ones and nothing helped.

    /*try {//-- Seems simpler, it should do the same as below, but didn't …
Run Code Online (Sandbox Code Playgroud)

sms android character-encoding special-characters

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

Admob广告未显示

我有一个问题,Admob没有显示广告......

这是LogCat:

WARN/AdMobSDK(502): Ignoring requestFreshAd() because we are requesting an ad right now already.
INFO/AdMobSDK(502): No fill.  Server replied that no ads are available (1164ms)
INFO/AdMobSDK(502): No fill.  Server replied that no ads are available (846ms)
Run Code Online (Sandbox Code Playgroud)

我已经尝试过测试模式,没有测试模式,模拟器,真正的手机等.它从来没有显示任何东西,但我得到了Admob统计数据的请求和打印,就像它曾经工作过...

AFAIK,我在Admob Android SDK中做了所有事情...唯一可能导致任何问题的事情,恕我直言,我将使用带有scrollview的标签式布局,然后是广告显示的相对布局...... .

以下是选项卡布局的示例:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:myapp="http://schemas.android.com/apk/res/com.xxx.xxx"
    android:id="@+id/tababout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FF000000">
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FF000000"
    android:padding="10px">

    <ImageView
        android:id="@+id/label_img"
        android:src="@drawable/about_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:scaleType="centerInside" />

    <TextView android:id="@+id/label_know_more_desc"
        style="@style/Desc"
        android:layout_below="@id/label_img"
        android:text="@string/tab_about_know_more_desc" />

    <Button android:id="@+id/bt_know_more"
        style="@style/Button"
        android:gravity="center_vertical|center_horizontal"
        android:layout_below="@id/label_know_more_desc"
        android:text="@string/tab_about_know_more_bt" /> …
Run Code Online (Sandbox Code Playgroud)

android admob

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