• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Can't create handler inside thread that has not called Looper.prepare()

The first thing you should do is re-evaluate why you are trying to use a handler in a thread other than the UI thread (which as a system-supplied looper).

Handlers only work by virtue of loopers. Almost everybody who uses handlers uses them in the UI thread because the UI thread runs under a looper. A looper is like a dispatcher that dispatches events to handlers in your code. These events can be anything from button presses to timers expiring. The UI code is built upon the idea that it is supposed to respond to events and then quickly return to the system (which is a looper).

A worker thread, on the other hand, is generally something that you start up to do something on its own without any interaction with the user. There are special mechanisms provided by Android to allow a worker thread to signal to the UI how it is going and when it is done. But basically the thread just runs straight line code, being interrupted only by Android OS time sharing and by calling blocking system methods (functions that must wait for something to happen before they can return.) It is never a good idea to have a thread sit "spinning its wheels" so to speak.

So if you really want to use a handler in your worker thread (as distinct from the User Interface thread on which the rest of your app runs) you have to become very familiar with loopers and how they are used. But I suspect you don't really want to create a handler. If you want to communicate with the UI thread, then use one of the recommended methods of doing that.
I figured out this question by removing from the code the creation of a new MainActivity class to access the variable inside it. That was my biggest mistake.

NestedScrollView and Searchbar

I hope is not too late to answer your question.

In your MainActivity, you can use
CoordinatorLayout, which used to include a new layout called app_bar_searchable, and also wrap your recyclerView.

Example

Java:
<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/coordinatorLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <include
            android:id="@+id/include"
            layout="@layout/app_bar_searchable" />

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipe_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            tools:layout_editor_absoluteX="0dp"
            tools:layout_editor_absoluteY="134dp">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/workRequestRecyclerView"
                android:name="zoinla.com.mypropertytech.fragment.WorkRequestFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"
                android:paddingBottom="@dimen/recyclerview_padding_bottom"
                app:layoutManager="LinearLayoutManager"
                tools:context=".ui.fragment.WorkRequestFragment"
                tools:listitem="@layout/fragment_workrequest" />
        </android.support.v4.widget.SwipeRefreshLayout>
    </android.support.design.widget.CoordinatorLayout>

</android.support.constraint.ConstraintLayout>

Then in your app_bar_searchable, you can design whatever you want it to be looked like.

Java:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/SearchableActionBar">
    <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|enterAlways">
        <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/round_background"
                android:elevation="1dp"
                android:layout_marginTop="@dimen/container_margin_large"
                android:layout_marginStart="@dimen/container_margin_large"
                android:layout_marginEnd="@dimen/container_margin_large"
                android:layout_marginBottom="@dimen/container_margin_tiny">
            <ImageView
                    android:id="@+id/imageView3"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_marginStart="@dimen/container_margin_medium"
                    android:src="@drawable/ic_search_24dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"/>
            <EditText
                    android:id="@+id/edtSearchFilter"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:paddingTop="12dp"
                    android:paddingBottom="12dp"
                    android:layout_marginStart="@dimen/container_margin_small"
                    android:textSize="@dimen/text_info"
                    android:textCursorDrawable="@null"
                    android:hint="@string/hint_search"
                    android:background="@null"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toStartOf="@+id/imvClearSearch"
                    app:layout_constraintStart_toEndOf="@+id/imageView3"
                    app:layout_constraintTop_toTopOf="parent"/>
            <ImageView
                    android:id="@+id/imvClearSearch"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingStart="@dimen/container_padding_medium"
                    android:paddingEnd="@dimen/container_padding_medium"
                    android:src="@drawable/ic_close_24dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    android:visibility="gone"/>
            <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" android:src="@drawable/ic_menu_24dp"
                    android:id="@+id/imvLogOut"
                    android:visibility="gone"
                    android:tint="@color/colorTextAccent"
                    android:layout_marginTop="8dp"
                    app:layout_constraintTop_toTopOf="parent" android:layout_marginBottom="8dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="@+id/edtSearchFilter" android:layout_marginEnd="8dp"/>
        </android.support.constraint.ConstraintLayout>
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

caldav calendar

Hi im looking for (free) application thats alows me connect to caldav server (baikal).
Url is look like http://companyweb.com/dav/cal.php/calendars/<username>/<calendarid>/ (autodiscovery is not supported).
I already tried some applications like "Caldav Sync Free Beta" or "Blue Mail" but with no success.
Tried url modifications:
Code:
http://companyweb.com/dav/cal.php/calendars/<username>/<calendarid>/
http://companyweb.com/dav/cal.php/calendars/<username>/
http://companyweb.com/dav/cal.php/calendars/
http://companyweb.com/dav/cal.php/
On pc (with thunderbird) work first perfect

Thanks for any sugestions

NestedScrollView does not scroll when RecyclerView scrolls

Hi friends, I have a RecyclerView in NestedScrollView. I set the size of the RecyclerView according to the screen size of the user. In this case, the recyclerview layout_height is 700dp, for example.

In this case, the problem is; The NestedScrollView does not scroll while the recyclerView is scrolling, and the nestedScrollView.setOnScrollChange method is not triggered.

What I want is; When scrolling on the recyclerView, NestedScrollView is also shifted and the nestedscrollView.setOnScrollChange method is triggered in any case. I've shared the layout below.
Is there anyone who can help?

Code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nestedScrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <androidx.appcompat.widget.SearchView
                    android:elevation="10dp"
                    android:id="@+id/searchView"
                    android:layout_width="match_parent"
                    android:layout_height="100dp"
                    android:layout_margin="4dp"
                    android:layout_marginStart="8dp"
                    android:layout_marginTop="8dp"
                    android:layout_marginEnd="8dp"
                    android:background="@color/colorAccent" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/recyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="4dp"
                    android:layout_marginTop="8dp"/>
            </LinearLayout>


</androidx.core.widget.NestedScrollView>

Memory booster pop up

There are three possibilities:

1) you didn't actually uninstall it (e.g. you just removed it from the desktop rather than uninstalling the app)
2) this is a different "memory booster", either built-in or which you installed (perhaps as part of something else)
3) these are not messages from a memory booster app but ads for that app being pushed by something else

The first thing is to check that it's really not installed. Go into your Settings > Apps and make sure it's not there. If it is, kill it with fire (all "memory booster" apps are scamware, and have no place on any android device).

GIFs not showing inline

1. I am already using the newest version of gmail for Android.

2. I had to uninstall Gboard for another reason. When I reinstalled it, I started having this problem where GIFs are not inserted inline, they are inserted as attachments. I am using the newest version of Gboard and the newest version of Gmail.

Let me ask a question. When you guys insert a GIF from the button to insert GIFs, does it insert the GIF inline like it used to do for me?

Context Menu - controlling position

OK, I realized that using a Context Menu was not the only way to go for detecting long-press on items in a ListView. Instead of registering for Context Menu on the list, I did this just after ListView list is created:

Code:
list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
      @Override
      public boolean onItemLongClick(AdapterView<?> parent, View view,
                              int position, long id) {
         final File f = new File(path.get(position));
         AlertDialog.Builder builder = new AlertDialog.Builder(FileExplorer.this);
         builder.setTitle(f.getName());
         String item1 = f.isDirectory() ? "Delete this directory" : "Delete this file";
         String item2 = f.isDirectory() ? "Rename this directory" : "Rename this file";
         String item3 = "Cancel (" + {{some file info}} + ")";
         List<String> choiceItems = new ArrayList<String>();
         choiceItems.add(item1);
         choiceItems.add(item2);
         choiceItems.add(item3);
         final CharSequence[] charSequenceItems = choiceItems.toArray(new CharSequence[choiceItems.size()]);
         builder.setItems(charSequenceItems,
               new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                     AlertDialog.Builder builder2 = new AlertDialog.Builder(FileExplorer.this);
                     AlertDialog alert2;
                     final String name =  f.getName();
                     switch (which) {
                        case 0:       //..delete file or folder
                           {{confirm delete, then delete file}}
                           break;
                        case 1:    //..Rename file or folder
                           {{validate new file name, then rename}}
                           break;
                        case 2:       //..Cancel.  do nothing.
                           break;
                     }
                  }
               });        //..end of builder.setItems
         builder.create().show();
         return true;
      }    //..end of onItemLongClick
   });

The resulting AlertDialog is positioned in the middle of the screen and always shows all choices without any scrolling.

Moto Z2 Play - how to disable Sim Card

I'd just remove your current SIM since you're going to be adding that temporary Orange SIM anyway.
But if you do just want to leave it in, it's not likely to be used while you're in France unless your current carrier's cellular network is compatible with Orange's cellular network (a possibility but still conditional) and you actively switch your phone over back to your current carrier -- it's your SIM that authenticates you to use a cellular network, so in the unlikely event you did intentionally try to use your current carrier's SIM with Orange's cellular network, it's also a matter where your carrier has to have some kind of contractual agreement with Orange to use their cellular network without using their SIM card).

Thanks, but still would be great if I could do this in software.May go airplane mode during the flight and remove it at Orange.

NW-Chat announcement

The best and easiest solution for you who wants to have a chat on your website.
The best and easiest solution for you who wants to have a chat on your website.
Setting up a chat can be very complex and expensive.
But with this chat solution, no technical knowledge is required at all and it's only a one-time cost.
Instructions:
1. Buy and download this app.
2. Launch the app and register a new account.
3. Receive an email with the script for the chat.
4. Copy and paste the script onto your website.
5. Everything is ready and you can now chat with your visitors
It's that easy :)
Now your visitors can start chatting with you directly to your mobile.
When a visitor clicks on the chat, a notification will be sent to your mobile saying that someone wants to chat.
You will now never miss a chance at an affair or the opportunity to help a customer / visitor.
Features:
- Chat.
- Mailform.
- Settings for username, chat colors and texts.
- Multi language support for Swedish and English.
In the app there's a tab for settings, where you can customize the chat the way you want it. You can choose if you are available to chat. If you are not available to chat, an mailform will appear instead. Where the visitor is allowed to leave their e-mail address and a message. This will send an e-mail to the e-mail address specified in your settings.
You can also customize the chat colors and texts.

https://play.google.com/store/apps/details?id=org.nixonsworld.nwchat

Try the chat at my own site:
https://nixonsworld.org/nw-chat
See ya :)

Attachments

  • Screenshot_20190727-000239.png
    Screenshot_20190727-000239.png
    93.3 KB · Views: 74
  • Screenshot_20190730-205553.png
    Screenshot_20190730-205553.png
    213.8 KB · Views: 70
  • Screenshot_20190730-205706.png
    Screenshot_20190730-205706.png
    63.5 KB · Views: 59

With a chain of work, each chain is executed many times and the first is ahead of the second

Here is the log with logcat:
Code:
08-02 19:54:05.004 118-1352/? I/GraphicBuffer: allocate buffer (w:480 h:800 f:5) err(0)
08-02 19:54:05.005 118-1352/? I/BufferQueue: [com.example.app1/com.example.app1.MainActivity] createGraphicBuffer before(NULL) after(0x41c561b8, handle=0x41c54f88, w=480, h=800, f=5)
08-02 19:54:05.012 12136-12136/com.example.app1 E/tag1: 1564692071288
08-02 19:54:05.012 12136-12136/com.example.app1 E/tag1: 1564692142434
08-02 19:54:05.012 12136-12136/com.example.app1 E/tag1: 1564691977054
08-02 19:54:05.012 12136-12136/com.example.app1 E/tag1: 1564692137410
08-02 19:54:05.013 12136-12136/com.example.app1 E/tag1: 1564692085695
08-02 19:54:05.013 12136-12136/com.example.app1 E/tag1: 1564692113982
08-02 19:54:05.015 12136-12136/com.example.app1 E/tag1: 1564691972016
08-02 19:54:05.015 12136-12136/com.example.app1 E/tag1: 1564692066231
08-02 19:54:05.015 12136-12136/com.example.app1 E/tag1: 1564692080662
08-02 19:54:05.015 12136-12136/com.example.app1 E/tag1: 1564692108958
08-02 19:54:05.019 118-1352/? I/SurfaceFlinger: [bool android::LayerBase::setFlagsEx(uint32_t, uint32_t)] (com.example.app1/com.example.app1.MainActivity) api:1, flags:0x00000000, mask:0x00000000
08-02 19:54:05.019 118-1352/? W/SurfaceFlinger:     nothing to do with mask 0x00000000
08-02 19:54:05.021 376-407/? I/ActivityManager: [AppLaunch] Displayed Displayed com.example.app1/.MainActivity: +867ms
08-02 19:54:05.027 12136-12136/com.example.app1 E/tag2: 1564692071288
08-02 19:54:05.027 12136-12136/com.example.app1 E/tag2: 1564692142434
08-02 19:54:05.029 12136-12136/com.example.app1 E/tag2: 1564691977054
08-02 19:54:05.031 12136-12136/com.example.app1 E/tag2: 1564692137410
08-02 19:54:05.032 12136-12136/com.example.app1 E/tag2: 1564692085695
08-02 19:54:05.035 12136-12136/com.example.app1 E/tag2: 1564692113982
08-02 19:54:05.035 12136-12136/com.example.app1 E/tag2: 1564691972016
08-02 19:54:05.035 12136-12136/com.example.app1 E/tag2: 1564692066231
08-02 19:54:05.037 12136-12136/com.example.app1 E/tag2: 1564692080662
08-02 19:54:05.037 12136-12136/com.example.app1 E/tag2: 1564692108958
08-02 19:54:05.050 118-118/? I/SurfaceFlinger: [bool android::LayerBase::setFlagsEx(uint32_t, uint32_t)] (Starting com.example.app1) api:2, flags:0x00000000, mask:0x00000000
08-02 19:54:05.050 118-118/? W/SurfaceFlinger:     nothing to do with mask 0x00000000
08-02 19:54:05.053 118-392/? I/BufferQueue: [Starting com.example.app1] disconnect: api=2
08-02 19:54:05.054 118-392/? I/SurfaceTexture: [Starting com.example.app1] [virtual void android::SurfaceTexture::onBuffersReleased()] mCurrentTexture:0, mCurrentBuf:0x41c4dae8
08-02 19:54:05.054 118-392/? I/BufferQueue: [Starting com.example.app1] getReleasedBuffers: returning mask 0xffffffff
08-02 19:54:05.064 118-219/? I/BufferQueue: [Starting com.example.app1] consumerDisconnect
08-02 19:54:05.064 118-219/? I/BufferQueue: [Starting com.example.app1] ~BufferQueue
08-02 19:54:05.069 118-10991/? I/GraphicBuffer: allocate buffer (w:480 h:800 f:5) err(0)
08-02 19:54:05.070 118-10991/? I/BufferQueue: [com.example.app1/com.example.app1.MainActivity] createGraphicBuffer before(NULL) after(0x41c567d8, handle=0x41c44b10, w=480, h=800, f=5)
08-02 19:54:05.582 459-459/? I/SurfaceTextureClient: [0x536b7260] frames:2, duration:1.507000, fps:1.327120
08-02 19:54:05.685 376-406/? I/AlarmManager: reset poweroff alarm none
08-02 19:54:05.712 12136-12156/com.example.app1 E/APP: doWork
08-02 19:54:05.721 12136-12150/com.example.app1 I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=8cba8fd0-795f-4834-882e-e42a84f2ffd9, tags={ com.example.app1.UploadWorker, tag1, tag2 } ]
08-02 19:54:05.726 12136-12150/com.example.app1 I/WM-WorkerWrapper: Setting status to enqueued for 38ec5c1e-34da-4106-9623-d71c1cfdab14
08-02 19:54:05.764 12136-12136/com.example.app1 E/tag1: 1564692071288
08-02 19:54:05.765 12136-12136/com.example.app1 E/tag1: 1564692142434
08-02 19:54:05.765 12136-12136/com.example.app1 E/tag1: 1564691977054
08-02 19:54:05.765 12136-12136/com.example.app1 E/tag1: 1564692137410
08-02 19:54:05.766 12136-12136/com.example.app1 E/tag1: 1564692085695
08-02 19:54:05.766 12136-12136/com.example.app1 E/tag1: 1564692113982
08-02 19:54:05.766 12136-12136/com.example.app1 E/tag1: 1564691972016
08-02 19:54:05.766 12136-12136/com.example.app1 E/tag1: 1564692066231
08-02 19:54:05.767 12136-12136/com.example.app1 E/tag1: 1564692080662
08-02 19:54:05.767 12136-12136/com.example.app1 E/tag1: 1564692108958
08-02 19:54:05.797 12136-12136/com.example.app1 E/tag2: 1564692071288
08-02 19:54:05.797 12136-12136/com.example.app1 E/tag2: 1564692142434
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564691977054
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564692137410
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564692085695
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564692113982
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564764845710
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564691972016
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564692066231
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564692080662
08-02 19:54:05.798 12136-12136/com.example.app1 E/tag2: 1564692108958
08-02 19:54:05.799 12136-12136/com.example.app1 E/tag1: 1564692071288
08-02 19:54:05.799 12136-12136/com.example.app1 E/tag1: 1564692142434
08-02 19:54:05.799 12136-12136/com.example.app1 E/tag1: 1564691977054
08-02 19:54:05.799 12136-12136/com.example.app1 E/tag1: 1564692137410
08-02 19:54:05.799 12136-12136/com.example.app1 E/tag1: 1564692085695
08-02 19:54:05.799 12136-12136/com.example.app1 E/tag1: 1564692113982
08-02 19:54:05.799 12136-12136/com.example.app1 E/tag1: 1564764845710
08-02 19:54:05.800 12136-12136/com.example.app1 E/tag1: 1564691972016
08-02 19:54:05.800 12136-12136/com.example.app1 E/tag1: 1564692066231
08-02 19:54:05.800 12136-12136/com.example.app1 E/tag1: 1564692080662
08-02 19:54:05.800 12136-12136/com.example.app1 E/tag1: 1564692108958
08-02 19:54:05.827 118-219/? I/SurfaceFlinger: [SurfaceFlinger] frames:7, duration:1.004000, fps:6.967839
08-02 19:54:07.090 459-459/? I/SurfaceTextureClient: [0x536b7260] frames:2, duration:1.507000, fps:1.327123
08-02 19:54:07.106 118-219/? I/SurfaceFlinger: [SurfaceFlinger] frames:2, duration:1.278000, fps:1.564302
08-02 19:54:07.997 376-391/? I/KeyguardUpdateMonitor: ACTION_BATTERY_CHANGED, status=2,plugged=2, level=78, health=2
08-02 19:54:08.597 459-459/? I/SurfaceTextureClient: [0x536b7260] frames:2, duration:1.506000, fps:1.327154
08-02 19:54:08.613 118-219/? I/SurfaceFlinger: [SurfaceFlinger] frames:2, duration:1.507000, fps:1.327119
08-02 19:54:09.138 459-459/? I/StateTracker: com.android.systemui.statusbar.toolbar.QuickOperationItemPanel$AirlineModeStateTracker@41687828setImageViewResources state is 0
08-02 19:54:09.138 459-459/? I/StateTracker: com.android.systemui.statusbar.toolbar.QuickOperationItemPanel$AirlineModeStateTracker@41687828 mIsUserSwitching is false
08-02 19:54:09.139 459-459/? I/StateTracker: com.android.systemui.statusbar.toolbar.QuickOperationItemPanel$AirlineModeStateTracker@41687828 mIsUserSwitching is false
08-02 19:54:09.139 459-459/? I/StateTracker: com.android.systemui.statusbar.toolbar.ConnectionSwitchPanel$AirlineModeStateTracker@416a0978setImageViewResources state is 0
08-02 19:54:09.140 459-459/? I/StateTracker: com.android.systemui.statusbar.toolbar.ConnectionSwitchPanel$AirlineModeStateTracker@416a0978 mIsUserSwitching is false
08-02 19:54:09.147 459-459/? I/StateTracker: com.android.systemui.statusbar.toolbar.ConnectionSwitchPanel$AirlineModeStateTracker@416a0978 mIsUserSwitching is false
08-02 19:54:09.147 376-788/? E/CellLocation: create GsmCellLocation
08-02 19:54:09.150 376-391/? E/CellLocation: create GsmCellLocation
08-02 19:54:09.153 376-391/? E/CellLocation: create GsmCellLocation
08-02 19:54:09.156 523-523/? I/CallNotifier: PhoneStateListener.onServiceStateChanged: serviceState=SIM1 0 home Tele2 Tele2 25020  HSPA CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false Regist state: 1
08-02 19:54:09.433 129-129/? W/MtkAgps: ** mtk_agps_update_cinfo(): imsi(250207413982106) mcc(250) mnc(20) lac(27874) cid(3454224)**
08-02 19:54:09.433 129-129/? W/MtkAgps:    -> update cell info: mcc(250)->(250) mnc(20)->(20) lac(27874)->(27874) cid(3454223)->(3454224)
08-02 19:54:09.433 129-129/? I/MtkAgps:      -> update supl_p: mcc(250) mnc(20) ucid(3454224), status(1)
08-02 19:54:10.104 459-459/? I/SurfaceTextureClient: [0x536b7260] frames:2, duration:1.507000, fps:1.327078
08-02 19:54:10.120 118-219/? I/SurfaceFlinger: [SurfaceFlinger] frames:2, duration:1.507000, fps:1.327004
08-02 19:54:10.724 376-406/? I/AlarmManager: reset poweroff alarm none
08-02 19:54:10.762 12136-12136/com.example.app1 E/tag1: 1564692071288
08-02 19:54:10.763 12136-12136/com.example.app1 E/tag1: 1564692142434
08-02 19:54:10.763 12136-12136/com.example.app1 E/tag1: 1564691977054
08-02 19:54:10.764 12136-12136/com.example.app1 E/tag1: 1564692137410
08-02 19:54:10.764 12136-12136/com.example.app1 E/tag1: 1564692085695
08-02 19:54:10.765 12136-12136/com.example.app1 E/tag1: 1564692113982
08-02 19:54:10.765 12136-12136/com.example.app1 E/tag1: 1564764845710
08-02 19:54:10.765 12136-12136/com.example.app1 E/tag1: 1564691972016
08-02 19:54:10.766 12136-12136/com.example.app1 E/tag1: 1564692066231
08-02 19:54:10.766 12136-12136/com.example.app1 E/tag1: 1564692080662
08-02 19:54:10.767 12136-12136/com.example.app1 E/tag1: 1564692108958
08-02 19:54:10.769 12136-12160/com.example.app1 E/APP: doWork
08-02 19:54:10.771 12136-12150/com.example.app1 I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=38ec5c1e-34da-4106-9623-d71c1cfdab14, tags={ com.example.app1.UploadWorker, tag1, tag2 } ]
08-02 19:54:10.776 12136-12136/com.example.app1 I/SurfaceTextureClient: [0x51df76e0] frames:5, duration:5.797000, fps:0.862438
08-02 19:54:10.856 12136-12136/com.example.app1 E/tag2: 1564692071288
08-02 19:54:10.856 12136-12136/com.example.app1 E/tag2: 1564692142434
08-02 19:54:10.857 12136-12136/com.example.app1 E/tag2: 1564764850767
08-02 19:54:10.857 12136-12136/com.example.app1 E/tag2: 1564691977054
08-02 19:54:10.858 12136-12136/com.example.app1 E/tag2: 1564692137410
08-02 19:54:10.858 12136-12136/com.example.app1 E/tag2: 1564692085695
08-02 19:54:10.858 12136-12136/com.example.app1 E/tag2: 1564692113982
08-02 19:54:10.859 12136-12136/com.example.app1 E/tag2: 1564764845710
08-02 19:54:10.859 12136-12136/com.example.app1 E/tag2: 1564691972016
08-02 19:54:10.860 12136-12136/com.example.app1 E/tag2: 1564692066231
08-02 19:54:10.860 12136-12136/com.example.app1 E/tag2: 1564692080662
08-02 19:54:10.861 12136-12136/com.example.app1 E/tag2: 1564692108958
08-02 19:54:10.910 12136-12136/com.example.app1 E/tag1: 1564692071288
08-02 19:54:10.911 12136-12136/com.example.app1 E/tag1: 1564692142434
08-02 19:54:10.911 12136-12136/com.example.app1 E/tag1: 1564764850767
08-02 19:54:10.912 12136-12136/com.example.app1 E/tag1: 1564691977054
08-02 19:54:10.912 12136-12136/com.example.app1 E/tag1: 1564692137410
08-02 19:54:10.913 12136-12136/com.example.app1 E/tag1: 1564692085695
08-02 19:54:10.913 12136-12136/com.example.app1 E/tag1: 1564692113982
08-02 19:54:10.914 12136-12136/com.example.app1 E/tag1: 1564764845710
08-02 19:54:10.914 12136-12136/com.example.app1 E/tag1: 1564691972016
08-02 19:54:10.914 12136-12136/com.example.app1 E/tag1: 1564692066231
08-02 19:54:10.915 12136-12136/com.example.app1 E/tag1: 1564692080662
08-02 19:54:10.915 12136-12136/com.example.app1 E/tag1: 1564692108958
08-02 19:54:11.611 459-459/? I/SurfaceTextureClient: [0x536b7260] frames:2, duration:1.507000, fps:1.327068
08-02 19:54:11.627 118-219/? I/SurfaceFlinger: [SurfaceFlinger] frames:5, duration:1.506000, fps:3.317970
08-02 19:54:13.118 459-459/? I/SurfaceTextureClient: [0x536b7260] frames:2, duration:1.507000, fps:1.327095
08-02 19:54:13.134 118-219/? I/SurfaceFlinger: [SurfaceFlinger] frames:2, duration:1.507000, fps:1.327057
08-02 19:54:14.627 459-459/? I/SurfaceTextureClient: [0x536b7260] frames:2, duration:1.509000, fps:1.325255
08-02 19:54:14.641 118-219/? I/SurfaceFlinger: [SurfaceFlinger] frames:2, duration:1.507000, fps:1.327107
08-02 19:54:14.737 376-413/? I/InputReader: Reconfiguring input devices.  changes=0x00000010
08-02 19:54:14.749 376-393/? I/ActivityManager: Start proc android.process.acore for broadcast com.android.providers.contacts/.PackageIntentReceiver: pid=12161 uid=10060 gids={3003, 1015, 1028}
08-02 19:54:14.780 12161-12161/? E/Trace: error opening trace file: No such file or directory (2)
08-02 19:54:14.786 562-562/? I/Launcher: setLoadOnResume
08-02 19:54:14.802 12161-12161/? I/ActivityThread: Pub com.android.voicemail: com.android.providers.contacts.VoicemailContentProvider
08-02 19:54:14.848 11639-11639/? I/AccountTypeManager: Received Intent:Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:com.example.app1 flg=0x8000010 (has extras) }
08-02 19:54:14.848 11639-11657/? I/AccountTypeManager: loadAccountsInBackground()+
Code in MainActivity:
Java:
TextView [text = findViewById(R.id.text);

		Constraints constraints = new Constraints.Builder().setRequiresCharging(true).build();
		Data data = new Data.Builder().putString(KEY_NAME, "Mike").build();
		OneTimeWorkRequest.Builder uploadWordRequest = new OneTimeWorkRequest.Builder(UploadWorker.class)
				.setConstraints(constraints)
				.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 5, TimeUnit.SECONDS)
				.setInputData(data)
				.keepResultsForAtLeast(2, TimeUnit.SECONDS);

		OneTimeWorkRequest one = uploadWordRequest.setInitialDelay(1, TimeUnit.SECONDS).addTag("tag1").build();
		OneTimeWorkRequest two = uploadWordRequest.setInitialDelay(5, TimeUnit.SECONDS).addTag("tag2").build();

		WorkManager w = WorkManager.getInstance(getApplicationContext());
		w.beginWith(one).then(two).enqueue();

		LiveData<List<WorkInfo>> l = w.getWorkInfosByTagLiveData("tag1");
		l.observe(this, new Observer<List<WorkInfo>>() {
			@SuppressLint("SetTextI18n")
			@Override
			public void onChanged(List<WorkInfo> workInfos) {
				for(int i=0;i<workInfos.size(); i++) {
					if(workInfos.get(i).getState() == WorkInfo.State.SUCCEEDED) {
						text.setText("" + workInfos.get(i).getOutputData().getLong(KEY_NAME, 0));
						Log.e("tag1", "" + workInfos.get(i).getOutputData().getLong(KEY_NAME, 0));
					}
				}
			}
		});
		w.getWorkInfosByTagLiveData("tag2").observe(this, new Observer<List<WorkInfo>>() {
			@SuppressLint("SetTextI18n")
			@Override
			public void onChanged(List<WorkInfo> workInfos) {
				for(int i=0;i<workInfos.size(); i++) {
					if(workInfos.get(i).getState() == WorkInfo.State.SUCCEEDED) {
						text.setText("" + workInfos.get(i).getOutputData().getLong(KEY_NAME, 0));
						Log.e("tag2", "" + workInfos.get(i).getOutputData().getLong(KEY_NAME, 0));
					}
				}
			}
		});
UploadWorker.java:
Java:
package com.example.app1;

import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.work.Data;
import androidx.work.Worker;
import androidx.work.WorkerParameters;

public class UploadWorker extends Worker {

	public UploadWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
		super(context, workerParams);
	}

	@NonNull
	@Override
	public Result doWork() {
		String key = "string1";
		Data ret = new Data.Builder().putLong(key, System.currentTimeMillis()).build();
		Log.e("APP", "doWork");
		return Result.success(ret);
	}
}
Why does the text not change 5 seconds after the application starts? It changes only once and this is not what I need!
You see that tag1 is ahead of tag2 which should not be. It is necessary that after a second the text is updated with the first value, and then after 4 seconds with a different value according to the logic of the code

Help Android head unit Ipod compatibility

Hi, I recently bought a head unit that's iPod compatible. But when I connect the iPod to the head unit thru USB, it doesn't identify the device at all. There's a native iPod app on the car stereo which says NO SONGS and closes the app.
Do you think if I install ROCKBOX on my iPod, the head unit will identify the iPod?
The model name says rk3368 from the Android about menu and running on Android 8.1

Filter

Back
Top Bottom