草庐IT

min_numbers

全部标签

java - 安卓测试 : Can I send sms to the emulator number from test method?

我从另一个团队收到了一些代码,开始进行简单的改进和重构。第一阶段是向项目添加单元测试。我需要测试解析输入短信的功能。与上述信息相关,我的问题是:-我可以从测试方法向模拟器端口发送短信吗?我写了下一个代码,但没有收到任何东西......@TestpublicvoidsendSmsTest(){SmsManagersmsManager=SmsManager.getDefault();smsManager.sendTextMessage("5554",null,getSms("sms1"),null,null);}privateStringgetSms(StringsmsKey){retur

android - 为什么来电号码在 Intent 额外的 TelephonyManager.EXTRA_INCOMING_NUMBER 中为空?

我有一个用Intent过滤器“android.intent.action.PHONE_STATE”定义的广播接收器。它主要可以很好地从Intent中获取电话号码,但有时,相当随机地,它在某些手机上会失败。它看起来像一些固件错误。有没有人遇到同样的问题并且知道实际原因是什么,如何应对? 最佳答案 我用过类似的东西......而且我使用它没有问题......IntentService=newIntent(context,PlayService.class).setAction("outgoing_call");IntentService

Android People.Number 和 People.Number_key 返回 null

我正在尝试从电话中获取联系人,但我只能获取姓名,电话号码返回空值。Cursorcursor=getContentResolver().query(People.CONTENT_URI,null,null,null,People.NAME+"ASC");startManagingCursor(cursor);cursor.moveToFirst();if(cursor.getCount()>0){while(cursor.moveToNext()){intidCol=cursor.getColumnIndex(People._ID);intnameCol=cursor.getColumn

android - ?安卓 :attr/selectableItemBackground` requires API level 11 (current min is 10)

如果我在我的卡片View中将其用作前台,应用程序将在API10之前崩溃。我正在从事一个大约七个月的项目,到目前为止,我的应用程序在每个API级别上都能正常工作。这迫使我提高我的最小SDK。你能帮我解决这个问题吗,我该如何绕过它。临时回答我在用这个android:foreground="?attr/selectableItemBackground"代替:android:foreground="?android:attr/selectableItemBackground"它是某种灰色onClick而不是蓝色,但我不太关心颜色,所以这将暂时解决崩溃问题 最佳答案

java - 意外字符 ('%'(代码 37)) : expected a valid value (number, 字符串、数组、对象、 'true'、 'false' 或 'null')

几天来,我一直在试图弄清楚这个错误的含义。当我尝试从Web服务下载文件时出现错误。完整的错误是:java.lang.RuntimeException:org.codehaus.jackson.JsonParseException:Unexpectedcharacter('%'(code37)):expectedavalidvalue(number,String,array,object,'true','false'or'null')at[Source:java.io.StringReader@39494c1;line:1,column:2]".从Web服务执行序列化和反序列化工作的类:

android - 错误 : Default interface methods are only supported starting with Nougat (--min-api 24) when NOT using them

在编译我的libgdx游戏时,我从android-studio收到以下错误:Error:DefaultinterfacemethodsareonlysupportedstartingwithAndroidN(--min-api24):com.hgames.core.item.Itemcom.hgames.core.item.misc.MiscItem.deepClone()我不明白,因为我不使用默认接口(interface)方法。我的代码在JDK1.7上编译得很好。此处报告的错误涉及以下代码:interfaceItem{ItemdeepClone()}interfaceMiscItem

android - Android google io 2011 java源代码中的MAGIC number

以下代码是从googleio开源中获取的。com.google.android.apps.iosched.util.Lists.javahttp://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/Lists.javapublicstaticArrayListnewArrayList(E...elements){intcapacity=(elements.length*110)/100+5;ArrayListlist=newArrayList(capacit

Android API 8 , 10 ContactsContract.Data.HAS_PHONE_NUMBER 没有这样的列

以下查询在我的设备(API15)上运行良好。它在运行API8或API10的模拟器中不起作用。这里是查询:CursorcontactsCur=getContentResolver().query(ContactsContract.Data.CONTENT_URI,newString[]{ContactsContract.Data._ID,ContactsContract.Data.CONTACT_ID,ContactsContract.Data.DISPLAY_NAME,ContactsContract.CommonDataKinds.Organization.COMPANY,Conta

android - "Get Phone Number in Android"的精确解

我试着用这个代码得到我自己的电话号码TelephonyManagerMgr=(TelephonyManager)Context.getSystemService(Context.TELEPHONY_SERVICE);mPhoneNumber=tMgr.getLine1Number();与但它不能正常工作。“获取安卓手机号”的具体解决方法是什么?谢谢 最佳答案 Whatistheexactsolutionofthe"GetPhoneNumberinAndroid"?让用户在EditText中输入一个,可能配置了android:inpu

android:inputType ="numberDecimal"与 InputType.TYPE_NUMBER_FLAG_DECIMAL

以下条件的计算结果为假。应该不是真的吧?editText.getInputType()==InputType.TYPE_NUMBER_FLAG_DECIMAL特别是在xml文件中,我有android:inputType="numberDecimal"调试表明editText.getInputType()=8194和InputType.TYPE_NUMBER_FLAG_DECIMAL=8192我错过了什么? 最佳答案 numberDecimal指的是TYPE_CLASS_NUMBER和TYPE_NUMBER_FLAG_DECIMAL。