Pit: Litepal save method returns true but not saved.

When developing Madoka diaries, when exporting and importing functions, I want to steal a lazy export, use Gson to transform Java objects into JSON and put them in txt, and then turn JSON into javaBean when importing.

The database I use is Litepal directly engage in, the advantage of using this library is fast, convenient, suitable for beginners.

But in fact, SQLite's syntax and some other statements are not difficult, so using this library is for convenience.

When you use Litepal to store data, you need to call the save () method.

I encountered a problem here. Obviously, the save () method returns true, but there is no data to store in the database.

 Gson gson = New Gson ();
Diary diary = Gson.fromJson (JSON, Diary.class );
Return Diary.save ();

This is called Gson to convert JSON to JavaBean object.

Obviously, the content of Diary is correct. I started asking about "Niang".

As a result, I didn't find any articles that were directly related to my question. As a result, I saw someone in Tucao setting getting, and I thought it would be because I didn't call Diary's construction method.

Diary, as a Litepal, is inherited from LitePalSupport. Is it because there is no way to call LitePalSupport?

I changed the import code to:

 Gson gson = New Gson ();
Diary diary = Gson.fromJson (JSON, Diary.class );
Diary saveDiary = New Diary ();
SaveDiary.setId ( Diary.getId ())
SaveDiary.setCreatedTime ( Diary.getCreatedTime ())
SaveDiary.setLastUpdatedTime ( Diary.getLastUpdatedTime ())
... omit ten thousand codes.
Return SaveDiary.save ();

Sure enough, finally normal.

(hydrology is so happy)


Android Shizuku source code analysis second

It is also a foreword.

Last article Analysis of Shizuku source code I have probably passed the application from ShizukuService to SystemService. At the end of the article, I mentioned only. Moe.shizuku.service The main method of Starter, which is wrapped under the Java class, starts the whole ShizukuService, so we can happily call the API of Shizuku.

Next we need to go deeper into the Navtive level. I want to know who is calling the main method of Starter. How to call it?

Analysis of Android Shizuku source code


In the last article, I used Shizuku to invoke system API: Article link

This time I'll take a look at how Shizuku's source code is written.

At first I looked at it with Notepad++. Finally, I would like to use as to see the source code.

Official documents

Cool download ShizukuManager

Watch it on GitHub

What is Shizuku?

Shizuku app will guide users to run a process (Shizuku service process) in root or ADB mode.

  1. When the process starts, the Shizuku service process sends binder to the application process.
  2. The application interacts with the Shizuku service process through the binder, and the Shizuku service process interacts with system server through binder.

Android monitors every move of the third party Activity.


The last update was six months ago. I don't feel like 2019. Nothing has been done. Nothing has improved.

Unconsciously, it is another new year. 2019 is last year, and 2018 is the year before last.

We haven't had much snow this winter. I remember that once I got snow, it melted quickly.

Infectious diseases have also appeared in China. So far, more than 5000 people have been shot. Now do not let go out, relatives have not finished, and now every day at home nest. But the advantage is that we don't have to go to school.

This year's CCTV Spring Festival Gala also did not see it. BiliBili also made a new year's offering. It's a year after year, but I'm not interested in watching it.

Recently, the magic girl has been watching slowly. In January, there was nothing new to expect. There was only one favorite: a scientific battery gun T, after all, I was in the pit. Another is the degree of invasion, I do not like the current plot, the only thing I like is OP.

Oh, in fact, there are also Acfun Darwin games that can only be broadcast. (because I like women's character)

Conclusion: in the month, Xin Fu liked only one song and one song.

I feel more and more meaningless. It may also be a change in my mindset. Now I have been looking at the old days.

Analysis of event distribution mechanism in Android notes #1 View


Basically, this article summarizes the View event distribution mechanism in the book "Android art development exploration".

Long ago, the Android Development notes were too chicken.

Brief introduction

As we all know, a sequence of events is caused by MotionEvent.ACTION_ DOWN (press) starts, multiple MotionEvent.MOVE (mobile) and one MotionEvent.ACTION_ UP (lifting) ends.

The transfer order of an event is Activity - > Window - > DecorView - > RootView (the View you set up).

ViewGroup is inherited from View, which is also the foundation of the foundation.

The pit of Zhi Yu daily

I didn't expect it! Ben dove thinks of his blog.

When the summer vacation arrived, I felt that time was no more than money. There was no concept of time. 233

I really have nothing to write about. Just tell me what has happened in these two days.

Yesterday I began to write a third party know about daily client.

Because it's too boring. Just do it. Use this API.

Simply talk about the problems before, and the process of development.

Using Hexo

Salty fish is not salty, starting from today (2019.5.25). Hexo La

It took more than a year for Typecho to change the new blog program, though a little unaccustomed, but I think Hexo is more useful than Typecho.

I didn't plan to move in before I wrote the article in Typecho, so is the comment.

The previous cuckoo accident caused the blog to lose many friends, QAQ.

I have gained a lot from blogging.

The heart of salty fish is not only salty, but because of boredom, and now it wants to have a place of sound in complex networks.

In the boundless sea, only this little wave shelter can give me peace of mind.

This is also a new start. The speed of updating blog will follow 233333.

Hello World

Welcome to Hexo This is your very first post. Check Documentation For more info. If you get any problems when using Hexo Troubleshooting Or you can ask me on GitHub .

Quick Start

Create a new post

 $hexo NEW "My New Post"

More info: Writing

Run server

 $hexo server

More info: Server

Generate static files

 $hexo generate

More info: Generating

Deploy to remote sites

 $hexo deploy

More info: Deployment

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now