Automate the generation of Findviewbyid with online tools

Source: Internet
Author: User

We often use the code when the Findviewbyid, take pains, I have introduced a very trickery method, very useful, here again:

 Public classKalebaseactivityextendsActivity {PrivateString TAG =getclass (). Getsimplename ();  Public Final<eextendsView> E GetView (intID) {Try {            return(E) Findviewbyid (ID); } Catch(ClassCastException ex) {LOG.E (TAG,"Could not cast View to concrete class.", ex); Throwex; }    }}

Write this into the activity's parent class, and you'll get the control later with GetView. Of course, if you are still accustomed to Findviewbyid, then the following two tools are absolutely right for you.

Creating an Findviewbyid interface from an XML layout

First, a simple and easy to use tool

http://android.lineten.net/layout.php

Second, a slightly more complex but powerful tool (recommended)

https://www.buzzingandroid.com/tools/android-layout-finder/

Automate the generation of Findviewbyid with online tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.