小编Ash*_*nki的帖子

如何解决此问题 目标 S+(版本 31 及更高版本)需要 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一

一直试图解决这个问题但无法解决。这是 udacity 课程,我尝试使用挂起意图创建通知,但挂起意图可变存在问题,我尝试用这种方式

视图模型

private val REQUEST_CODE = 0
private val TRIGGER_TIME = "TRIGGER_AT"

private val minute: Long = 60_000L
private val second: Long = 1_000L

private val timerLengthOptions: IntArray
private val notifyPendingIntent: PendingIntent

private val alarmManager = app.getSystemService(Context.ALARM_SERVICE) as AlarmManager
private var prefs =
    app.getSharedPreferences("com.shivaConsulting.androidProjects.kotlinnotificatons", Context.MODE_PRIVATE)
private val notifyIntent = Intent(app, AlarmReciever::class.java)

private val _timeSelection = MutableLiveData<Int>()
val timeSelection: LiveData<Int>
    get() = _timeSelection

private val _elapsedTime = MutableLiveData<Long>()
val elapsedTime: LiveData<Long>
    get() = _elapsedTime

private var _alarmOn = MutableLiveData<Boolean>() …
Run Code Online (Sandbox Code Playgroud)

android kotlin kotlin-android

19
推荐指数
2
解决办法
4万
查看次数

在Android API 28中不推荐使用view.getDrawingCache()

在android API 28中view.getDrawingCache()已被弃用.有没有更新的解决方案来生成Android中的特定视图的位图.

android screenshot bitmap

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

如何使用 ADB 删除 Android 上的文件

我正在尝试使用单个 ADB 命令删除 Android 上的文件。

\n\n

我知道您可以执行 adb shell,然后使用 rm 删除文件。

\n\n

但我需要它是一行执行。

\n\n

我\xe2\x80\x99已经尝试过:

\n\n
adb rm-f /directory/file.txt\n\nadb shell rm-f /directory/file.txt\n
Run Code Online (Sandbox Code Playgroud)\n\n

两者都不\xe2\x80\x99t删除我想要的文件。

\n

android adb

15
推荐指数
2
解决办法
6万
查看次数

增加 firebase firestore 中的现有值

有没有办法增加firestore 中的现有值?

我正在尝试什么。
    FirebaseFirestore.getInstance()
            .collection("notifications")
            .document(response.getString("multicast_id"))
            .set(notificationData);
    FirebaseFirestore.getInstance()
            .collection("users")
            .document(post.userId)
            .get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
        @Override
        public void onComplete(@NonNull Task<DocumentSnapshot> task) {
            if (task.isSuccessful()) {
                int followers = Integer.valueOf(task.getResult().getData().get("followers").toString());
                FirebaseFirestore.getInstance()
                        .collection("users")
                        .document(post.userId).update("followers", followers++).addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                    }
                });
            }
        }
    });
Run Code Online (Sandbox Code Playgroud) 数据库结构
users

  - data....
  - followers(number)
Run Code Online (Sandbox Code Playgroud)

根据此答案函数可用于增加或减少数字字段值

版本 5.9.0 - 2019 年 3 月 14 日

添加了 FieldValue.increment(),它可以在 update() 和 set(..., {merge:true}) 中使用,以在没有事务的情况下安全地递增或递减数字字段值。

https://firebase.google.com/support/release-notes/js

是否有任何函数可用于增加 firestore android 中的现有值?

java android firebase google-cloud-firestore

8
推荐指数
1
解决办法
8219
查看次数

关闭我的应用程序时更改默认键盘

我正在使用键盘项目.Every Thing工作正常,但当我关闭用于键盘主题选择的应用程序时,我的键盘从默认键盘中删除...

之后我想重新选择我的键盘然后它的工作正常..

我的阙.是为什么关闭应用程序时默认键盘发生了变化?任何人都知道为什么会这样......?

注意:此问题仅来自Vivo:Funtouch OS等自定义操作系统

它在三星和其他手机等的工作正常..

java keyboard android

7
推荐指数
0
解决办法
217
查看次数

Linux 中的 Android Studio 模拟器错误

显示错误如

> Emulator: warning: host doesn't support requested feature:
  CPUID.80000001H:ECX.abm [bit 5]
Run Code Online (Sandbox Code Playgroud)

错误

linux ubuntu android

3
推荐指数
1
解决办法
9437
查看次数

notification.setOngoing(true) 在 Android 8.1 中不起作用

 build.setOngoing(true);
 build.setAutoCancel(false);
 notification.flags= Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
Run Code Online (Sandbox Code Playgroud)

setOngoing 不起作用

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

                /* Create or update. */
                 _notificationChannel = new NotificationChannel("TubeMateGo",
                        "Downlaod File Notification",
                        NotificationManager.IMPORTANCE_DEFAULT);
                mNotifyManager.createNotificationChannel(_notificationChannel);
                build = new NotificationCompat.Builder(getBaseContext(),_notificationChannel.getId());
                build.setContentTitle("Download")
                        .setContentText("Download in progress")
                        .setSmallIcon(R.drawable.ic_launcher_foreground);
                build.setOngoing(true);
                build.setChannelId(_notificationChannel.getId());
                build.setVisibility(Notification.VISIBILITY_PUBLIC);
                build.setAutoCancel(false);

                build.setContentIntent(_pedingIntent);

                Notification notification = build.build();
                notification.flags= Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
                mNotifyManager.notify(id, notification);
            }
            else {
                build = new NotificationCompat.Builder(getBaseContext());
                build.setContentTitle("Download")
                        .setContentText("Download in progress")
                        .setSmallIcon(R.drawable.ic_launcher_foreground);
                build.setOngoing(true);
                build.setVisibility(Notification.VISIBILITY_PUBLIC);

                Notification notification = build.build();
                notification.flags=Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
                mNotifyManager.notify(id, notification);
            }
Run Code Online (Sandbox Code Playgroud)

当我尝试从通知栏中删除通知时,它删除了为什么?

我不知道我哪里出错了

根据文档

public Notification.Builder …
Run Code Online (Sandbox Code Playgroud)

java android operating-system android-notifications android-8.0-oreo

3
推荐指数
1
解决办法
1788
查看次数

如何在 Exoplayer 中暂停/恢复视频?

我正在使用Exoplayer播放视频

Code For Playing Video


private PlayerView videoView;
SimpleExoPlayer player;
Run Code Online (Sandbox Code Playgroud)
    videoView = findViewById(R.id.video_view);
    player = ExoPlayerFactory.newSimpleInstance(this, new DefaultTrackSelector());
    videoView.setPlayer(player);
    player.prepare(buildMediaSource(Uri.parse(_videoUrl)));
    player.setPlayWhenReady(true);

    videoView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            //i want to pause video
            //next time i want to resume
            return false;
        }
    });
Run Code Online (Sandbox Code Playgroud)

XML CODE


<com.google.android.exoplayer2.ui.PlayerView
    android:id="@+id/video_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginBottom="8dp"
    //i don't want to use controls to i am setting false
    app:use_controller="false"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
Run Code Online (Sandbox Code Playgroud)

我找不到任何有用的文档来暂停和恢复视频

我的要求是pause/resume在任何人触摸 …

java android exoplayer

3
推荐指数
1
解决办法
3153
查看次数

自定义共享意图对话框可能吗?

打开共享意图的代码

String xtype = "image/*";
Intent share = new Intent(Intent.ACTION_SEND);
share.setType(xtype);
Uri uri = FileProvider.getUriForFile(mContext, BuildConfig.APPLICATION_ID + ".provider", new File(tmpImageUri.getPath()));
share.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(share, "Share via"));
Run Code Online (Sandbox Code Playgroud)

它显示了这样的共享意图对话框

默认共享意向

但是现在我想要这样

我想要分享意图

可以自定义“共享意图”对话框吗?

java android android-intent

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