Startactivityforresult using the tab activity Solution

Source: Internet
Author: User

When startactivityforresult is called in the tab activity to obtain the running result of the sub-activity, the onactivityresult method cannot be called back.

This usually happens in activitygroup (I guess, I haven't studied the source code) Because activitygroup enters the activity stack instead of the tab activity when the tab activity enters the sub-activity, the design should be reasonable, not a bug.

Solution:

1. Use in tab Activity

Getparent (). startactivityforresult (intent, request );

2. When the sub-activity. Finish returns, onactivityresult is implemented in activitygroup. The content is similar:

@ Override protected void onactivityresult (INT requestcode, int resultcode, intent data) {// pass youractivity currentactivity = (youractivity) getlocalactivitymanager () down (). getcurrentactivity (); currentactivity. onchildactivityresult (requestcode, resultcode, data );}

Onchildactivityresult is a self-implemented method used to process the returned results.

Refer:

Http://stackoverflow.com/questions/6677466/stuck-with-getting-camera-pic-when-using-the-tab-activity

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.