Published in


Android DTT #18 — Copy History

When I refactor some code, I found myself in need to copy and paste a lot of things. Whether it’s adding a field that is needed in many classes. Putting a method call in many activities. Or just moving some code around.

For example, I’m adding a dependencies to my presenters, UserRepository, SettingRepository and FeedRepository.

This is the code that will be add to the presenter in need:

protected UserRepository userRepository;
protected SettingRepository settingRepository;
protected FeedRepository feedRepository;

But not all presenters would need all of them. Some presenters only need one of them.

I can copy the entire code above and delete the repository which the presenter doesn’t need.

That’s so old school.

What I prefer to do is to copy each of the field and keep it on the copy history. Then I pressed CMD+SHIFT+V instead of only CMD+V to bring up a dialog, which I can choose which to paste.

AS can keep track 5 last text copy you made. This will be sure come in handy.

If you like this, hit that heart button and recommend it to your friends.

ADTT (Android Development Tips and Tricks) is a 31 series of blog posts that I’m trying to finish in throughout May. Click here for index.



The (retired) Pub(lication) for Android & Tech, focused on Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store