diff --git a/app/src/main/java/com/example/alexey/mylauncher/MyService.java b/app/src/main/java/com/example/alexey/mylauncher/MyService.java index 4221647..32d2ca2 100644 --- a/app/src/main/java/com/example/alexey/mylauncher/MyService.java +++ b/app/src/main/java/com/example/alexey/mylauncher/MyService.java @@ -52,7 +52,8 @@ public void onDestroy() { @Override public int onStartCommand(Intent intent, int flags, int startId) { - this.pi = intent.getParcelableExtra("pendingIntent"); + if (intent != null) + this.pi = intent.getParcelableExtra("pendingIntent"); if (run != null) run.stop(); es.execute(run = new MyRun()); @@ -91,6 +92,8 @@ private void sendImage() { if (size != 0) intent.putExtra("imageFileName", (cur % size) + ".png"); try { + if (pi == null) + return; pi.send(MyService.this, 0, intent); lastSendImage = System.currentTimeMillis(); preference.edit().putLong(LAST_SEND_IMAGE, lastSendImage).apply(); diff --git a/app/src/main/java/com/example/alexey/mylauncher/recyclerview/AppList.java b/app/src/main/java/com/example/alexey/mylauncher/recyclerview/AppList.java index a0b83c9..05ff526 100644 --- a/app/src/main/java/com/example/alexey/mylauncher/recyclerview/AppList.java +++ b/app/src/main/java/com/example/alexey/mylauncher/recyclerview/AppList.java @@ -208,6 +208,11 @@ private void initApp() { App newApp = new App(name, packageName, icon, timeInstalled); addApp(newApp); } + ArrayList list = (ArrayList) getAppsList().clone(); + for (App app1 : list) { + if (app1.getIcon() == null) + removeApp(app1.getPackageName()); + } } public void addApp(@NonNull App app) {