Android Dual Screen different display

Source: Internet
Author: User

Android dual screen is clone mode, if you want to display different content on the second screen, you need to customize a presentation class

1. Set Permissions First

(just start tossing for a long time no effect, later found that is not set permissions)

    <!--display the System window permissions--    <uses-permission android:name= "Android.permission.SYSTEM_ALERT_WINDOW"/>    <!--display addview-->    <uses-permission android:name= "Android.permission.SYSTEM_OVERLAY_WINDOW" at the top of the screen/ >

 

2. Custom Classes

public class Differentdislay extends presentation{public    differentdislay (Context outercontext, display display) { C1/>super (Outercontext,display);           } @Override    protected void onCreate (Bundle savedinstancestate) {        super.oncreate (savedinstancestate);        Setcontentview (r.layout.test);            }}

3. Then this code will allow the second screen to display different content.

Displaymanager mdisplaymanager;//Screen Management class Mdisplaymanager = (Displaymanager) this.getsystemservice (Context.DISPLAY_ SERVICE);D isplay[] Displays = Mdisplaymanager.getdisplays (); if (mpresentation = = null) {mpresentation = new Differentdislay (this, displays[displays.length-1]);//displays[1] is a sub-screen Mpresentation.getwindow (). SetType ( WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); Mpresentation.show ();}

  

Android Dual Screen different display

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.