草庐IT

set_null

全部标签

java - File.list() 为目录返回 null

执行代码时Filepath=newFile("/data");booleanisDir=path.isDirectory();//isDiristrueString[]fList=path.list();//fList==null!在Android2.3模拟器上,文件列表为空。这似乎与文档http://developer.android.com/reference/java/io/File.html#list中的声明相矛盾():Returnsnullifthisfileisnotadirectory.这里有什么问题吗? 最佳答案 您

android - SipDemo 管理器在设备 SamSung SII android SIP API 中始终为 null

最近尝试在android中使用SIPAPI,经过多次搜索,我找到了SipDemo(android-10的sampleproject)。我只是在Eclipse中导入项目。然而,当我在这个项目中寻找细节时(通过Log.e(...)),我发现SipManagermanager总是null甚至就在这一行之后:manager=SipManager.newInstance(this);。因此,无论我向SIP提供商注册什么,我都无法正常工作!有人有同样的问题吗?谁能给我一个建议?编辑:如果我使用linkhere,我可以让我的模拟器与register、call和receive一起工作。但是,对于我的设

android - Sherlock 操作栏 : findViewById(android. R.id.home)在 android 2.3 中返回 null

我正在为我的项目使用SherlockActionBar。但我面临问题。我在OnCreate方法中使用此代码。ActionBaractionBar=getSupportActionBar();actionBar.setHomeButtonEnabled(true);actionBar.setDisplayHomeAsUpEnabled(true);ViewiconImage=findViewById(android.R.id.home);iconImage.setPadding(100,0,0,0);在android4.1中,“iconImage”不为空。但是在安卓2.3上。iconIm

android - Gradle settings cannot be cast 错误

尝试构建新项目时,org.jetbrains.plugins.gradle.settings.GradleSettingscannotbecasttoorg.jetbrains.plugins.gradle.settings.GradleSettings错误我下载了http://services.gradle.org/distributions/gradle-1.6-bin.zip手动将zip内容复制到C:\ProgramFiles(x86)\Android\android-studio\plugins\gradle文件夹并从C:\ProgramFiles(x86)\Android\a

android - 为什么 TextToSpeech.getLanguage() *有时* 会返回 null?

在我的应用中,我调用了TextToSpeech.getLanguage()在实例化TextToSpeech之后很好(根据LogCat,大约800毫秒),但它有时(不总是)返回null,尽管在系统的TextToSpeech设置中正确设置了语言:SystemSettings>Language&input>Text-to-speechoutput>GoogleText-to-speech>English(UnitedKingdom)这只发生在JellyBean(Android4.1.1)中。它不会发生在Android2.2中。这是一个已知的Android错误吗?还是我做错了什么?顺便说一句,

android 蓝牙连接失败(isSocketAllowedBySecurityPolicy 开始 : device null)

我正在尝试用蓝牙连接两部手机(galaxynote1、galaxynote2),但套接字连接失败。这是我的LogCat:I/BluetoothService(24036):BEGINmConnectThreadD/BluetoothUtils(24036):isSocketAllowedBySecurityPolicystart:devicenullD/BluetoothService(24036):setState()2->1D/BluetoothService(24036):ConnectFailD/BluetoothService(24036):startV/BluetoothS

android - 关于 Activity 结果相机 Intent 在三星 s4 中返回 null

在此先感谢您的帮助。这是我在创建我的第一个应用程序时遇到的问题。我正在制作应用程序,用户可以在其中选择从图库或相机拍摄图像,当从图库导入图像时,应用程序按预期工作,但是当从相机拍摄图像时,intent返回空。IntentcameraIntent=newIntent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,outputFileUri);startActivityForResult(cameraIntent,YOUR_SELECT_PICT

java - 空指针异常, "Attempt to read from field on a null object reference"

我正在制作一个应用程序,用户可以在其中键入任务列表,然后将该列表保存到一个数组中。数组中的每个任务都是Assignment类的一个实例。但是,我意识到在java中不可能在创建数组后向数组添加元素。所以,我所做的是创建一个名为tasks的数组,其中包含许多空值:Assignment[]tasks={null,null,null,null,null,null,null,null,null,null,null,null};.当我想向数组添加任务时,我只需将下一个空值替换为对象即可。但是,我还需要有一个只有任务的数组,没有空值。所以我为所有不为空的元素创建了一个名为full_tasks的数组:

android - 回收站 View : Set scroll position so that item appears at the bottom of the view

我有一个RecyclerView和一个LinearLayoutManager,它由一个适配器提供支持,该适配器具有不同高度的项目。有没有办法告诉RecyclerView设置滚动位置,以便项目X(或多或少)恰好出现在屏幕底部?我试过LinearLayoutManager.scrollToPosition()但这会将项目定位在View的顶部。 最佳答案 MyAdaptermAdapter;RecyclerViewrecyclerView;Listdata=newArrayList();LinearLayoutManagerllm=new

android - 代码检查高亮 : cannot set different highlight style for Info and Weak Warning severities

在AndroidStudio2.1.2中,我无法为Info严重性级别(由我的代码检查配置文件确定)设置突出显示样式。它使用WeakWarning样式显示。我按照说明操作fromtheofficialdocshere但我没有看到信息条目,只有弱警告条目。这感觉像是IDE中的一个错误,因为当我单击“编辑|颜色和字体”按钮时,我被带到了我在该部分中选择的最后一个项目,而不是正确的项目,即“信息”(或也许那是因为不存在这样的“信息”项。我也无法弄清楚如何将“信息”的新项目添加到“颜色和字体”下的列表中。 最佳答案 INFO严重性已弃用,如对