Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void threadTest(Context context, String s) {
- Runnable cu = new threadTestClass(context, s);
- Thread cuThread = new Thread(cu);
- cuThread.start();
- }
- private static class threadTestClass implements Runnable {
- private final Context context;
- private final String str;
- public threadTestClass(Context cont, String s) {
- context = cont;
- str = s;
- }
- public void run() {
- NotificationManager mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- Notification.Builder nBuilder = new Notification.Builder(context);
- nBuilder.setContentTitle("IGRUS!");
- nBuilder.setContentText(str);
- nBuilder.setSmallIcon(R.mipmap.ic_launcher);
- nBuilder.setOngoing(false);
- nBuilder.setProgress(100, 1, true);
- for (int i = 1; i < 10; i++) {
- mNotifyManager.notify(i, nBuilder.build());
- try {
- Thread.sleep(1000);
- } catch (Exception e) {
- //
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement