Android Studio practical guide 8.20 refining Interfaces
Refining interface reconstruction is to extract an interface from an existing class. It can select a method from a class and extract the selected method to a separate interface.
Procedure:
? Menu Bar: Refactor-> Extract-> Interface...
Example:
Step 2: place the cursor anywhere in a class-> execution menu bar: Refactor-> Extract-> Interface... -> The configuration dialog box is displayed.
Step 2: Enter the interface name IContentItem. Select the getContentUri () and getcontentintent (context: Context) methods and extract them to the interface.-> execute refactoring. <Strong? Http: www.bkjia.com kf ware vc "target =" _ blank "class =" keylink "> VcD4NCjxwPszhyKG1xL3Tv9rI58/codecomvcd4ncjxwcmugy2xhc3m9 "brush: java;"> /*** Created by bixiaopeng on 16/1/3. */public interface IContentItem {Uri getContentUri (); Intent getincluintent (Context context );}
The original class implements this interface:
Public class ContentItem implements IContentItem {...}