我的应用程序正在运行,并且从 Google Play Console出现“由:android.database.sqlite.SQLiteCantOpenDatabaseException: ”引起的崩溃。
大多数情况下,它发生在 Android 9 操作系统上,并且它即将推出的所有设备中有 50% 是 Google Pixel 设备。我尝试了其他具有 android 9 但没有运气的设备。我没有 Google Pixel 设备。无论如何,任何人都建议我修复或复制它。
我知道以编程方式插入铃声,但我想知道从系统铃声列表中删除特定铃声.我所知道的是铃声的标题.
我搜索了很多关于它的信息,但不幸的是,找不到任何方法来实现我想要的.
请指导我使用铃声标题删除铃声的方式.
嗨我试图获取ID我设置在每个这些线性布局,但我得到了
android.widget.LinearLayout@41032a40或类似的对我来说没什么用处.
我已将id设置为row1,这就是我想要返回的内容.
我确定我以前做过类似的事情,所以我无法弄清楚为什么它会返回上面的内容.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/row1"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="@android:color/black"
android:onClick="xmlClickHandler" />
<LinearLayout
android:id="@+id/row2"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="@android:color/white"
android:onClick="xmlClickHandler" />
<LinearLayout
android:id="@+id/row3"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="@android:color/black"
android:onClick="xmlClickHandler" />
<LinearLayout
android:id="@+id/row4"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="@color/white"
android:onClick="xmlClickHandler" />
<LinearLayout
android:id="@+id/row5"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="@color/yellow"
android:onClick="xmlClickHandler" />
<LinearLayout
android:id="@+id/row6"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="@color/blue"
android:onClick="xmlClickHandler" />
Run Code Online (Sandbox Code Playgroud)
public void xmlClickHandler(View v) {
Log.d("CLICK ROW", String.valueOf(v));
}
Run Code Online (Sandbox Code Playgroud) 我如何获得当前正在运行的应用程序?
我想检查应用程序是否正在运行.我使用了以下代码.
ActivityManager activityManager =
(ActivityManager)
this.getSystemService(ACTIVITY_SERVICE );
PackageManager pm =getPackageManager();
procInfos = activityManager.getRunningAppProcesses();
Run Code Online (Sandbox Code Playgroud)
但即使我按下主屏幕上的按钮,它也会返回几个应用程序列表.正在运行的应用列表仍在列表中显示它们.但我希望该列表仅显示前台的应用程序.
那么,如何区分前台和后台运行的应用程序?
或者换句话说,如何检测当前前台运行的应用程序,或者未被销毁的应用程序.我不想让后台运行应用程序.
我以编程方式创建RelativeLayout,因此,我需要以android:clickable="true"编程方式添加此xml属性.
如何才能做到这一点?谢谢!
我试图以编程方式更改形状的颜色,但它不起作用.
这是形状
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#9F2200"/>
<stroke android:width="2dp" android:color="#fff" />
</shape>
Run Code Online (Sandbox Code Playgroud)
这是我如何使用它作为按钮的背景
<Button
android:id="@+id/ibtn_EA_ColorPick_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/round_button"
/>
Run Code Online (Sandbox Code Playgroud)
这就是我如何改变它的颜色
GradientDrawable bgShape = (GradientDrawable)btn_ColorPick.getBackground();
bgShape.setColor(Color.RED);
Run Code Online (Sandbox Code Playgroud)
但是,当我改变背景颜色时,它会从屏幕上删除按钮.
我一直在布局上努力解决这个问题.为了简单起见,我有一个截图.

我想正确地将具有"3小时前"内容的textview对齐.对于这个TextView,我将layout_below属性设置为上面的Linearlayout(包含两个textviews,其内容为36.90° celius,如图所示).
我试过android:layout_alignRight ="@ + id/rl1",它将textview对齐.但是当几小时前TextView的内容大于上面的内容时,它会被剪掉().
有人,请帮帮我.
这是代码(不是整个代码).只是右侧的部分
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:id="@+id/rl1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subVitalValueTextView"
android:gravity="center_vertical"
android:text="5.05"
android:textSize="22dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subVitalUnitTextView"
android:text="feet"
android:paddingLeft="5dp"/>
</LinearLayout>
<TextView
android:layout_marginTop="-6dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/subVitalTimeAgoTextView"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="5 hours ago"
android:fontFamily="sans-serif-thin"
android:layout_below="@+id/rl1"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) android ×7
xml ×2
clickable ×1
detect ×1
foreground ×1
google-pixel ×1
onclick ×1
right-align ×1
ringtone ×1
title ×1
view ×1