Call between add Address Book classes

Source: Internet
Author: User

The previous one mentioned that it must be placed under the activity.

First, when a class under the activity is calledCodeAs follows:

 
Public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. main); addcontactsold (); // you must remember the class that cannot be added to the new activity, haha .............................}

The code to be added to the called class is as follows:

 
Public class contacttest extends androidtestcase {context; Public contacttest (context CT) {// todo auto-generated method stubthis. context = CT;} public context getcontext () {// todo auto-generated method stubreturn context ;}}

The code added in the activity is

Public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. main); contacttest = new contacttest (this); contacttest. testinsert ();...........................}

It is expected that Java will always appear in the use of online code. lang. nullp ....... the wrong person may have some help. I may not have strong Java knowledge. I spent two whole days in the afternoon.

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.