草庐IT

android-storage

全部标签

android - 在 android 中调用 finish() 后应用程序没有关闭

我正在开发一个应用程序,其中有一个对话框,当我单击退出按钮时,我想关闭该应用程序,但有时应用程序无法完成并返回到我的第一个Activity。我不知道该怎么办。相同的代码AlertDialog.BuilderalertDialog=newAlertDialog.Builder(getContext());alertDialog.setMessage(context.getResources().getString(R.string.app_close_dialog_msg));alertDialog.setPositiveButton(R.string.app_close_dialog_

Android Studio 3.0.1 错误 :Already seen doctype

我只使用Psiphon连接到Internet。由于我已将androidstudio更新到版本3,因此我面临以下gradlesync错误:Error:Alreadyseendoctype. 最佳答案 同步开始时,AndroidStudio会显示代理设置。选中“启用HTTPS代理”并设置类似于HTTP代理设置的“主机名”和“端口名”。注意:5100是我自己的代理端口,请使用您的代理端口号。不要忘记如下设置AndroidStudio的代理设置: 关于AndroidStudio3.0.1错误:A

android - 将数据从 Android 发送到 Simblee BLE 不返回任何内容

下面是我的Simblee的草图:#includevoidsetup(){Serial.begin(9600);Serial.println("Waitingforconnection...");SimbleeBLE.deviceName="Simblee";SimbleeBLE.advertisementData="data";//SimbleeBLE.customUUID="2220";SimbleeBLE.advertisementInterval=MILLISECONDS(300);SimbleeBLE.txPowerLevel=-20;//(-20dbMto+4dBm)Simb

Android Room 库错误 : Cannot find setter for field. (Kotlin)

我正在使用房间图书馆,我有下面提到的实体:@Parcelize@Entity(tableName="tb_option")dataclassOptionsTable(varquestion_id:Int?=null,varoption_id:Int?=null,varoption:String?=null,varis_selected:Int?=null,@PrimaryKey(autoGenerate=true)varsr_no:Int=0):Parcelable如您所见,我将所有字段声明为var但它仍然显示错误:error:Cannotfindsetterforfield.e:e:

android - 从 LiveData.observe() 添加项目到适配器的最佳实践

我有DAO方法返回LiveData>:LiveData>listLiveData=categoryDao.getAll();之后我需要将此数据设置到我的适配器:listLiveData.observe(this,categories->{if(categories==null||categories.isEmpty()){price.setVisibility(View.VISIBLE);recyclerView.setVisibility(View.INVISIBLE);}else{categoryAdapter=newCategoryAdapter(categories);cate

Android:使用Firebase存储静态数据

我正在开发一个Android应用程序,允许用户查找有关我所在城市街道的信息。他们将能够注册一些街道并将其保存为“收藏夹”。我的问题是,考虑到它们不会随时间变化,我如何使用Firebase来存储街道数据? 最佳答案 Firebase数据模型不太适合存储数组(或JavaList对象)。Seethisblogpostexplaining你得到的行为。followtheFirebasedocumentation'sapproach不是存储列表,而是用于存储集合。这确实会将其存储为map,这恰恰是正确的做法。

android - 获取自定义 View 的 xml id

我有一个自定义ViewZoneSwitchItem(扩展了LinearLayout),我在fragment布局xml中使用它。在自定义View中,我需要获取在fragmentxml中分配给它的ID。所以我使用attrs.getIdAttribute();但它返回null而不是预期的IDzone1。我可以添加一个自定义属性ZoneSwitchItemId但如果我可以使用默认的id属性,我想避免这种情况。fragmentxml中的用法:...自定义View:publicclassZoneSwitchItemextendsLinearLayout{privateTextViewitemVal

android - Gradle 项目同步在 Android Studio 3.0.1 上失败

我是第一次在我的笔记本电脑上安装AndroidStudio3.0.1,但我无法创建我的第一个HelloWorld应用。我收到以下错误:Createprocessfailed,error=216Error:ConsultyourIDElogformoredetails可以在thisscreenshot上看到错误. 最佳答案 转到文件->项目结构,取消选中“使用嵌入式JDK”并选择32位JDK。 关于android-Gradle项目同步在AndroidStudio3.0.1上失败,我们在St

android - 加载大 PDF 时应用程序崩溃

有人知道如何在Android中加载大的pdf文件吗?我使用“android-pdf-viewer”来加载那种文件。它在文件很小的时候起作用。但是一旦文件太大(例如150M),就会抛出OOM异常。11-2821:07:43.5967844-8419/com.example.caoweizhao.readerappE/art:Outofmemory:HeapSize=192MB,Allocated=83MB,Capacity=192MB11-2821:07:43.5967844-8419/com.example.caoweizhao.readerappW/art:ThrowingOutOf

android - RealmMigrationNeededException 同时

我有一个使用旧版realm(v0.85.1)的实时应用程序,我正在开发一个使用4.2.0版realm并且也有模式更改的新版本。架构更改只是将单个列添加到一个表中。对于迁移,我有这个类。publicclassImRealmMigrationimplementsRealmMigration{@Overridepublicvoidmigrate(DynamicRealmrealm,longoldVersion,longnewVersion){RealmSchemaschema=realm.getSchema();if(oldVersion==0){schema.get("Layout").a