• React Native

Secondary Display Control via Android Presentation Class

Updated 26 October 2021

In this blog, we will learn about Secondary Display Control via Android Presentation Class.

Well, the title line certainly deals with a lot of words that probably most of the developers are not aware of and frankly, even I was not aware of this beauty of Android until last month.

Before we start, let me just tell you a few practical use cases for what you can build after following along.

  • POS Hardware Machines & their Dedicated Application –> Have you seen the agents at big retail centers using POS machines? There you can see what is being added to your cart at the same moment and the agent is processing your order. If you peek at agent’s screen the content will be a bit(or entirely) different.
  • Presentation Apps –> Have you seen the applications where whole presentation(ppts, slides) are being controlled by some android device? If you peek at the Android device screen the slides are bit different (like with notes, descriptions, etc) but on the secondary screen (like a projector )  the presentation is entirely different.

After reading this blog you will also be able to build something similar.

Before we start talking about code let’s just clear what the words in the title are.

A display is referred to as a screen or area which can show the content.

As a result, an Android device can control any number of displays.

The main point to note is that the application’s code should be able to handle each display separately and these are in sync with the main display.

Main Display

This display refers to the actual screen provided by the manufacturer of the Android device.

Hence, this screen listens to all the user interactions, gestures and motions events.

As a result, this display is referred to as Main Display.

Secondary Display

This display refers to a secondary screen which is somehow (Bluetooth, wired connections, RFC) connected to your Android device.

By Default, this screen is not user interactive and hence it is called as Display and not Screen.

Presentation Class

A presentation is a special kind of dialog whose purpose is to present content on a secondary display. A Presentation is associated with the target Display at creation time and configures its context and resource configuration according to the display’s metrics. — developer.android.com

For Simple understanding, we need to extend this class to build a view to display on our Secondary Display.

With this understanding, now you can do anything you want on Secondary Display.

Now, in this blog, we will just be making a Welcome TextView on the Secondary Display.

  • First, create a layout file that will be displayed on the secondary Display. For simplicity, name this file secondary_display.xml
  • Now, we create a class that will extend the Presentation Class. Let’s name this class SecondaryDisplay.
  • The Presentation class object we just created will have a default constructor and override the onCreate Method.
  • The constructor will take Context & a display as arguments. This will be a reference to the secondary Display.
  • The onCreate Method is similar to the Activity’s onCreate Method.
  • Now to display this content, you just need to initialize the constructor of the SecondaryDisplay class and call the show() method. (just like we do for a dialog).

File Name –> secondary_display.xml

xml version="1.0" encoding="utf-8"?> RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".SecondaryDisplay"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_margin="8dp" android:padding="4dp" android:text="Hello, Presentation Api, \nThis text will be displayed on the secondary display" android:textAppearance="?android:attr/textAppearanceMedium" /> /RelativeLayout>

File Name –> SecondaryDisplay.java

class SecondaryDisplay extends Presentation { /** public SecondaryDisplay(Context outerContext, Display display) { super(outerContext, display); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.secondary_display); }

With the help of lines below, you can set the Secondary Display Content.

class  MainActivity extends AppCompatActivity{ public DisplayManager displayManager = null; public Display[] presentationDisplays = null; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); displayManager =  (DisplayManager)getSystemService(Context.DISPLAY_SERVICE); if (displayManager!= null){ presentationDisplays = displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION); if (presentationDisplays.length > 0){               SecondaryDisplay secondaryDisplay = new SecondaryDisplay(MainActivity.this, presentationDisplays[0]); secondaryDisplay.show();               } } }

With this last change, you have completed the task.

Now, just run your application on a device with  Secondary Display and see the magic.

Keep coding and Keep Sharing 🙂

References –> https://developer.android.com/reference/android/app/Presentation

https://developer.android.com/reference/android/view/Display.html

author

  • 26 Oct, 2021 Updated by - Kushal Varshney
  • 19 May, 2019 Updated by - anchit

Leave a Comment Cancel Reply

Your email address will not be published. Required fields are marked*

Save my name email and website in this browser for the next time I comment.

27 comments

presentation class android

You can easily try this option in any android device or emulators.

All you need to do is to enable the developer options.

Then in the developer options menu find the option “Simulate secondary displays”.

From the list that opens up , you can easily select the width option as per your need.

presentation class android

I am assuming that by control you want to listen to some of the events on the secondary display.

So, if that is all about majorly click listeners then you can add them as you add it to any of the views in your code in your secondary display class as well.

Though, I have not practically implemented any listeners for the secondary display.

But i guess, this should work fine.

Still, if you are looking for soemthing else, then feel free to type more over here.

Regards, Anchit

presentation class android

If you know the solution then please let me know.

Thanks, Sunil

I would need access to your code and then only i can help you out.

presentation class android

This seems to be pretty easy.

You can either create some method in your secondary display class and update the ui accordingly.

You can declare the components public and then access the same in the main activity.

Both will work.

presentation class android

I personally have not worked on automotive AVD.

As per me the connection to secondary screen in AVD will depend totally on how both of the screens are connected.

If the connection is physically wired, then you can also go with the points mentioned in the article.

Regarding mailing details, please do send your query to [email protected]

presentation class android

To do this should I call presentation in all activities? Or can I call it from base activity?

i would recommend you to call in the base activity.

when you need to change the content on the secondary display just override the activity.

presentation class android

your welcome

presentation class android

while running this example on emulator. looking forward for your help.

For both points, please first check that the secondary display is fully simulated on your emulator.

If you are able to successfully simulate the dual-screen, then the article is good enough to work like a charm.

presentation class android

Please do share the same.

presentation class android

Your Welcome

presentation class android

also my project is library based where one base project and other modules are divided into libraries. so how to handle this kind of structure?

Yes, we can capture user input and interaction if the secondary hardware supports it.

Sorry, I can’t share samples right now but this is possible with simple logic.

For library-based project, i would recommend adding this functionality to the base project itself so that you can use it on the go in different libraries as per the use case.

Rest all can be done as per your project’s requirement.

We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy

Enquiry or Requirement

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Android Developers

  • Google Play Developer Console
  • Android Developers Blog
  • About Android
  • Android.com
  • Android Developers
  • Android Open Source Project
  • Get Started
  • Building Blocks
  • Get the SDK
  • Google Services
  • Google Play
  • App Quality
  • Open Distribution
  • android.accessibilityservice
  • android.accounts
  • android.animation
  • android.app
  • android.app.admin
  • android.app.backup
  • android.appwidget
  • android.bluetooth
  • android.content
  • android.content.pm
  • android.content.res
  • android.database
  • android.database.sqlite
  • android.drm
  • android.gesture
  • android.graphics
  • android.graphics.drawable
  • android.graphics.drawable.shapes
  • android.hardware
  • android.hardware.display
  • android.hardware.input
  • android.hardware.usb
  • android.inputmethodservice
  • android.location
  • android.media
  • android.media.audiofx
  • android.media.effect
  • android.mtp
  • android.net
  • android.net.http
  • android.net.nsd
  • android.net.rtp
  • android.net.sip
  • android.net.wifi
  • android.net.wifi.p2p
  • android.net.wifi.p2p.nsd
  • android.nfc
  • android.nfc.tech
  • android.opengl
  • android.os.storage
  • android.preference
  • android.provider
  • android.renderscript
  • android.sax
  • android.security
  • android.service.dreams
  • android.service.textservice
  • android.service.wallpaper
  • android.speech
  • android.speech.tts
  • android.support.v13.app
  • android.support.v4.accessibilityservice
  • android.support.v4.app
  • android.support.v4.content
  • android.support.v4.content.pm
  • android.support.v4.database
  • android.support.v4.net
  • android.support.v4.os
  • android.support.v4.util
  • android.support.v4.view
  • android.support.v4.view.accessibility
  • android.support.v4.widget
  • android.telephony
  • android.telephony.cdma
  • android.telephony.gsm
  • android.test
  • android.test.mock
  • android.test.suitebuilder
  • android.text
  • android.text.format
  • android.text.method
  • android.text.style
  • android.text.util
  • android.util
  • android.view
  • android.view.accessibility
  • android.view.animation
  • android.view.inputmethod
  • android.view.textservice
  • android.webkit
  • android.widget
  • dalvik.bytecode
  • dalvik.system
  • java.awt.font
  • java.lang.annotation
  • java.lang.ref
  • java.lang.reflect
  • java.nio.channels
  • java.nio.channels.spi
  • java.nio.charset
  • java.nio.charset.spi
  • java.security
  • java.security.acl
  • java.security.cert
  • java.security.interfaces
  • java.security.spec
  • java.util.concurrent
  • java.util.concurrent.atomic
  • java.util.concurrent.locks
  • java.util.jar
  • java.util.logging
  • java.util.prefs
  • java.util.regex
  • java.util.zip
  • javax.crypto
  • javax.crypto.interfaces
  • javax.crypto.spec
  • javax.microedition.khronos.egl
  • javax.microedition.khronos.opengles
  • javax.net.ssl
  • javax.security.auth
  • javax.security.auth.callback
  • javax.security.auth.login
  • javax.security.auth.x500
  • javax.security.cert
  • javax.xml.datatype
  • javax.xml.namespace
  • javax.xml.parsers
  • javax.xml.transform
  • javax.xml.transform.dom
  • javax.xml.transform.sax
  • javax.xml.transform.stream
  • javax.xml.validation
  • javax.xml.xpath
  • junit.framework
  • junit.runner
  • org.apache.http
  • org.apache.http.auth
  • org.apache.http.auth.params
  • org.apache.http.client
  • org.apache.http.client.entity
  • org.apache.http.client.methods
  • org.apache.http.client.params
  • org.apache.http.client.protocol
  • org.apache.http.client.utils
  • org.apache.http.conn
  • org.apache.http.conn.params
  • org.apache.http.conn.routing
  • org.apache.http.conn.scheme
  • org.apache.http.conn.ssl
  • org.apache.http.conn.util
  • org.apache.http.cookie
  • org.apache.http.cookie.params
  • org.apache.http.entity
  • org.apache.http.impl
  • org.apache.http.impl.auth
  • org.apache.http.impl.client
  • org.apache.http.impl.conn
  • org.apache.http.impl.conn.tsccm
  • org.apache.http.impl.cookie
  • org.apache.http.impl.entity
  • org.apache.http.impl.io
  • org.apache.http.io
  • org.apache.http.message
  • org.apache.http.params
  • org.apache.http.protocol
  • org.apache.http.util
  • org.w3c.dom
  • org.w3c.dom.ls
  • org.xml.sax
  • org.xml.sax.ext
  • org.xml.sax.helpers
  • org.xmlpull.v1
  • org.xmlpull.v1.sax2
  • ActionBar.OnMenuVisibilityListener
  • ActionBar.OnNavigationListener
  • ActionBar.TabListener
  • Application.ActivityLifecycleCallbacks
  • DatePickerDialog.OnDateSetListener
  • FragmentBreadCrumbs.OnBreadCrumbClickListener
  • FragmentManager.BackStackEntry
  • FragmentManager.OnBackStackChangedListener
  • KeyguardManager.OnKeyguardExitResult
  • LoaderManager.LoaderCallbacks
  • PendingIntent.OnFinished
  • SearchManager.OnCancelListener
  • SearchManager.OnDismissListener
  • TimePickerDialog.OnTimeSetListener
  • ActionBar.LayoutParams
  • ActionBar.Tab
  • ActivityGroup
  • ActivityManager
  • ActivityManager.MemoryInfo
  • ActivityManager.ProcessErrorStateInfo
  • ActivityManager.RecentTaskInfo
  • ActivityManager.RunningAppProcessInfo
  • ActivityManager.RunningServiceInfo
  • ActivityManager.RunningTaskInfo
  • ActivityOptions
  • AlarmManager
  • AlertDialog
  • AlertDialog.Builder
  • AliasActivity
  • Application
  • ApplicationErrorReport
  • ApplicationErrorReport.AnrInfo
  • ApplicationErrorReport.BatteryInfo
  • ApplicationErrorReport.CrashInfo
  • ApplicationErrorReport.RunningServiceInfo
  • DatePickerDialog
  • DialogFragment
  • DownloadManager
  • DownloadManager.Query
  • DownloadManager.Request
  • ExpandableListActivity
  • Fragment.SavedState
  • FragmentBreadCrumbs
  • FragmentManager
  • FragmentTransaction
  • Instrumentation
  • Instrumentation.ActivityMonitor
  • Instrumentation.ActivityResult
  • IntentService
  • KeyguardManager
  • KeyguardManager.KeyguardLock
  • LauncherActivity
  • LauncherActivity.IconResizer
  • LauncherActivity.ListItem
  • ListActivity
  • ListFragment
  • LoaderManager
  • LocalActivityManager
  • MediaRouteActionProvider
  • MediaRouteButton
  • NativeActivity
  • Notification
  • Notification.BigPictureStyle
  • Notification.BigTextStyle
  • Notification.Builder
  • Notification.InboxStyle
  • Notification.Style
  • NotificationManager
  • PendingIntent

Presentation

  • ProgressDialog
  • SearchableInfo
  • SearchManager
  • TabActivity
  • TaskStackBuilder
  • TimePickerDialog
  • UiModeManager
  • WallpaperInfo
  • WallpaperManager
  • Fragment.InstantiationException
  • PendingIntent.CanceledException
   ↳
     ↳ android.app.Presentation

Class Overview

A presentation is a special kind of dialog whose purpose is to present content on a secondary display. A Presentation is associated with the target Display at creation time and configures its context and resource configuration according to the display's metrics.

Notably, the Context of a presentation is different from the context of its containing Activity . It is important to inflate the layout of a presentation and load other resources using the presentation's own context to ensure that assets of the correct size and density for the target display are loaded.

A presentation is automatically canceled (see cancel() ) when the display to which it is attached is removed. An activity should take care of pausing and resuming whatever content is playing within the presentation whenever the activity itself is paused or resumed.

Choosing a presentation display

Before showing a Presentation it's important to choose the Display on which it will appear. Choosing a presentation display is sometimes difficult because there may be multiple displays attached. Rather than trying to guess which display is best, an application should let the system choose a suitable presentation display.

There are two main ways to choose a Display .

Using the media router to choose a presentation display

The easiest way to choose a presentation display is to use the MediaRouter API. The media router service keeps track of which audio and video routes are available on the system. The media router sends notifications whenever routes are selected or unselected or when the preferred presentation display of a route changes. So an application can simply watch for these notifications and show or dismiss a presentation on the preferred presentation display automatically.

The preferred presentation display is the display that the media router recommends that the application should use if it wants to show content on the secondary display. Sometimes there may not be a preferred presentation display in which case the application should show its content locally without using a presentation.

Here's how to use the media router to create and show a presentation on the preferred presentation display using getPresentationDisplay() .

The following sample code from ApiDemos demonstrates how to use the media router to automatically switch between showing content in the main activity and showing the content in a presentation when a presentation display is available.

Using the display manager to choose a presentation display

Another way to choose a presentation display is to use the DisplayManager API directly. The display manager service provides functions to enumerate and describe all displays that are attached to the system including displays that may be used for presentations.

The display manager keeps track of all displays in the system. However, not all displays are appropriate for showing presentations. For example, if an activity attempted to show a presentation on the main display it might obscure its own content (it's like opening a dialog on top of your activity).

Here's how to identify suitable displays for showing presentations using getDisplays(String) and the DISPLAY_CATEGORY_PRESENTATION category.

The following sample code from ApiDemos demonstrates how to use the display manager to enumerate displays and show content on multiple presentation displays simultaneously.

  • for information on about live video routes and how to obtain the preferred presentation display for the current media route.
  • for information on how to enumerate displays and receive notifications when displays are added or removed.
From interface
int
int
int The identifier for the negative button.
int The identifier for the neutral button.
int The identifier for the positive button.
Public Constructors
( outerContext, display)
( outerContext, display, int theme)
Public Methods
() that this presentation appears on.
() that should be used to inflate the layout of this presentation.
() to which the presentation is attached have changed.
() to which the presentation is attached has been removed.
() .
Protected Methods
()
()
From class ( view, params)
()
()
()
( ev)
( event)
( event)
( event) s.
( ev)
( ev)
(int id) .
() attached to this dialog, if present.
()
() on the Window if this Activity to return the currently focused view.
()
()
()
()
()
()
()
( mode)
( mode)
()
()
() or ).
( item)
( menu)
( savedInstanceState) , you should initialize your dialog in this method, including calling .
( menu, v, menuInfo)
( menu) if the client desires the same menu for this Dialog.
(int featureId, menu)
(int featureId)
()
( event)
(int keyCode, event)
(int keyCode, event) : always returns false (doesn't handle the event).
(int keyCode, int repeatCount, event) : always returns false (doesn't handle the event).
(int keyCode, event)
(int keyCode, event)
(int featureId, item)
(int featureId, menu)
( item)
( menu)
(int featureId, menu)
( menu) if the client desires the same menu for this Dialog.
(int featureId, view, menu)
( savedInstanceState)
()
()
()
()
( event)
( event)
( params)
(boolean hasFocus)
( callback)
( view)
()
( view)
(int featureId)
( msg)
(boolean flag) key.
(boolean cancel)
( view)
(int layoutResID)
( view, params)
( msg)
(int featureId, drawable) .
(int featureId, int alpha) .
(int featureId, int resId) .
(int featureId, uri) .
( listener)
( listener)
( onKeyListener)
( listener)
( activity)
(int titleId)
( title)
(int streamType)
()
(boolean get)
( view)

presentation class android

() .
( o)
()
<?> () that represents this object's class.
()
() methods) to be woken up.
() methods) to be woken up.
()
() or method of this object.
(long millis, int nanos) or method of this object or until the specified timeout expires.
(long millis) or method of this object or until the specified timeout expires.
()
()
(int keyCode, event)
(int keyCode, event)
(int keyCode, int count, event)
(int keyCode, event)
( menu, v, menuInfo)
( event)
( event)
( event)
( event) s.
( event)
( event)
( mode)
( mode)
()
() or ).
(int featureId, menu)
(int featureId)
()
(int featureId, item)
(int featureId, menu)
(int featureId, menu)
(int featureId, view, menu)
()
( attrs)
(boolean hasFocus)
( callback)

Public Constructors

Public presentation ( context outercontext, display display).

Creates a new presentation that is attached to the specified display using the default theme.

outerContext The context of the application that is showing the presentation. The presentation will create its own context (see ) based on this context and information about the associated display.
display The display to which the presentation should be attached.

public Presentation ( Context outerContext, Display display, int theme)

Creates a new presentation that is attached to the specified display using the optionally specified theme.

outerContext The context of the application that is showing the presentation. The presentation will create its own context (see ) based on this context and information about the associated display.
display The display to which the presentation should be attached.
theme A style resource describing the theme to use for the window. See for more information about defining and using styles. This theme is applied on top of the current theme in . If 0, the default presentation theme will be used.

Public Methods

Public display getdisplay ().

Gets the Display that this presentation appears on.

  • The display.

public Resources getResources ()

Gets the Resources that should be used to inflate the layout of this presentation. This resources object has been configured according to the metrics of the display that the presentation appears on.

  • The presentation resources object.

public void onDisplayChanged ()

Called by the system when the properties of the Display to which the presentation is attached have changed. If the display metrics have changed (for example, if the display has been resized or rotated), then the system automatically calls cancel() to dismiss the presentation.

  • getDisplay()

public void onDisplayRemoved ()

Called by the system when the Display to which the presentation is attached has been removed. The system automatically calls cancel() to dismiss the presentation after sending this event.

public void show ()

Inherited from show() . Will throw WindowManager.InvalidDisplayException if the specified secondary Display can't be found.

Protected Methods

Protected void onstart ().

Called when the dialog is starting.

protected void onStop ()

Called to tell you that you're stopping.

About Android   |  Legal   |  Support

Android DownloadManager

Android expandablelistactivity tutorial with examples, android fragment, android fragmentmanager, android fragmenttransaction, android google map, android instrumentation, android intentservice, android keyguardmanager, android launcheractivity tutorial with examples, android listactivity, android listfragment tutorial with examples, android loadermanager, android localactivitymanager, android notification, android notificationchannel, android notificationchannelgroup, android notificationmanager, android pendingintent, android presentation, android progressdialog, android remoteinput, android searchableinfo, android searchmanager, android service, android tabactivity tutorial with examples, android taskstackbuilder, android timepickerdialog, android uiautomation, android uimodemanager, android wallpapermanager, android presentation tutorial with examples.

Base class for presentations.

Introduction

A presentation is a special kind of dialog whose purpose is to present content on a secondary display.

A Presentation is associated with the target Display at creation time and configures its context and resource configuration according to the display's metrics.

Notably, the Context of a presentation is different from the context of its containing Activity .

It is important to inflate the layout of a presentation and load other resources using the presentation's own context to ensure that assets of the correct size and density for the target display are loaded.

A presentation is automatically canceled (see Dialog#cancel() ) when the display to which it is attached is removed.

An activity should take care of pausing and resuming whatever content is playing within the presentation whenever the activity itself is paused or resumed.

Choosing a presentation display

Before showing a Presentation it's important to choose the Display on which it will appear.

Choosing a presentation display is sometimes difficult because there may be multiple displays attached.

Rather than trying to guess which display is best, an application should let the system choose a suitable presentation display.

There are two main ways to choose a Display .

Using the media router to choose a presentation display

The media router service keeps track of which audio and video routes are available on the system.

The media router sends notifications whenever routes are selected or unselected or when the preferred presentation display of a route changes.

So an application can simply watch for these notifications and show or dismiss a presentation on the preferred presentation display automatically.

The preferred presentation display is the display that the media router recommends that the application should use if it wants to show content on the secondary display.

Sometimes there may not be a preferred presentation display in which case the application should show its content locally without using a presentation.

Here's how to use the media router to create and show a presentation on the preferred presentation display using android.media.MediaRouter.RouteInfo#getPresentationDisplay() .

The following sample code from ApiDemos demonstrates how to use the media router to automatically switch between showing content in the main activity and showing the content in a presentation when a presentation display is available.

Another example

Using the display manager to choose a presentation display

Another way to choose a presentation display is to use the DisplayManager API directly.

The display manager service provides functions to enumerate and describe all displays that are attached to the system including displays that may be used for presentations.

The display manager keeps track of all displays in the system.

However, not all displays are appropriate for showing presentations.

For example, if an activity attempted to show a presentation on the main display it might obscure its own content (it's like opening a dialog on top of your activity).

Creating a presentation on the main display will result in android.view.WindowManager.InvalidDisplayException being thrown when invoking #show() .

Here's how to identify suitable displays for showing presentations using DisplayManager#getDisplays(String) and the DisplayManager#DISPLAY_CATEGORY_PRESENTATION category.

The following sample code from ApiDemos demonstrates how to use the display manager to enumerate displays and show content on multiple presentation displays simultaneously.

The following code shows how to use Presentation from android.app .

  • Español – América Latina
  • Português – Brasil
  • Tiếng Việt
  • Android Developers

Handle multi-touch gestures

presentation class android

A multi-touch gesture is when multiple pointers (fingers) tap the screen at the same time. This document describes how to detect gestures that involve multiple pointers.

Track multiple pointers

When multiple pointers tap the screen at the same time, the system generates the following touch events:

  • ACTION_DOWN : sent when the first pointer taps the screen. This starts the gesture. The pointer data for this pointer is always at index 0 in the MotionEvent .
  • ACTION_POINTER_DOWN : sent when extra pointers enter the screen after the first. You can obtain the index of the pointer that just went down using getActionIndex() .
  • ACTION_MOVE : sent when a change occurs in a gesture, involving any number of pointers.
  • ACTION_POINTER_UP : sent when a non-primary pointer goes up. You can obtain the index of the pointer that just went up using getActionIndex() .
  • ACTION_UP : sent when the last pointer leaves the screen.
  • ACTION_CANCEL : indicates that the entire gesture, including all pointers, is canceled.

Start and end gestures

A gesture is a series of events starting with an ACTION_DOWN event and ending with either an ACTION_UP or ACTION_CANCEL event. There is one active gesture at a time. The actions DOWN, MOVE, UP, and CANCEL apply to the entire gesture. For example, an event with ACTION_MOVE can indicate a movement for all pointers down at that moment.

Keep track of pointers

Use the pointer's index and ID to keep track of the individual pointers positions within a MotionEvent .

  • Index : a MotionEvent stores pointer information in an array. The index of a pointer is its position within this array. Most of the MotionEvent methods take the pointer index as a parameter, rather than the pointer ID.
  • ID : each pointer also has an ID mapping that stays persistent across touch events to allow for tracking of an individual pointer across the entire gesture.

Individual pointers appear within a motion event in an undefined order. Thus, the index of a pointer can change from one event to the next, but the pointer ID of a pointer is guaranteed to remain constant as long as the pointer remains active. Use the getPointerId() method to obtain a pointer's ID to track the pointer across all subsequent motion events in a gesture. Then, for successive motion events, use the findPointerIndex() method to obtain the pointer index for a given pointer ID in that motion event. For example:

To support multiple touch pointers, you can cache all active pointers with their IDs at their individual ACTION_POINTER_DOWN and ACTION_DOWN event time. Remove the pointers from your cache at their ACTION_POINTER_UP and ACTION_UP events. You might find these cached IDs helpful to handle other action events correctly. For example, when processing an ACTION_MOVE event, find the index for each cached active pointer ID, retrieve the pointer's coordinates using the getX() and getY() functions, then compare these coordinates with your cached coordinates to discover which pointers moved.

Use the getActionIndex() function with ACTION_POINTER_UP and ACTION_POINTER_DOWN events only. Don't use this function with ACTION_MOVE events, as this always returns 0 .

Retrieve MotionEvent actions

Use the getActionMasked() method or the compatibility version MotionEventCompat.getActionMasked() to retrieve the action of a MotionEvent . Unlike the earlier getAction() method, getActionMasked() is designed to work with multiple pointers. It returns the action without the pointer indices. For actions with a valid pointer index, use getActionIndex() to return the index of the pointers associated with the action as shown in the following snippet:

Additional resources

For more information related to input events, see the following references:

  • Input events overview
  • Sensors overview
  • Make a custom view interactive

Content and code samples on this page are subject to the licenses described in the Content License . Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2024-06-27 UTC.

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Presentation Class

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Base class for presentations.

A presentation is a special kind of dialog whose purpose is to present content on a secondary display. A Presentation is associated with the target Display at creation time and configures its context and resource configuration according to the display's metrics.

Notably, the Context of a presentation is different from the context of its containing Activity . It is important to inflate the layout of a presentation and load other resources using the presentation's own context to ensure that assets of the correct size and density for the target display are loaded.

A presentation is automatically canceled (see Dialog#cancel() ) when the display to which it is attached is removed. An activity should take care of pausing and resuming whatever content is playing within the presentation whenever the activity itself is paused or resumed.

<h3>Choosing a presentation display</h3>

Before showing a Presentation it's important to choose the Display on which it will appear. Choosing a presentation display is sometimes difficult because there may be multiple displays attached. Rather than trying to guess which display is best, an application should let the system choose a suitable presentation display.

There are two main ways to choose a Display .

<h4>Using the media router to choose a presentation display</h4>

The easiest way to choose a presentation display is to use the android.media.MediaRouter MediaRouter API. The media router service keeps track of which audio and video routes are available on the system. The media router sends notifications whenever routes are selected or unselected or when the preferred presentation display of a route changes. So an application can simply watch for these notifications and show or dismiss a presentation on the preferred presentation display automatically.

The preferred presentation display is the display that the media router recommends that the application should use if it wants to show content on the secondary display. Sometimes there may not be a preferred presentation display in which case the application should show its content locally without using a presentation.

Here's how to use the media router to create and show a presentation on the preferred presentation display using android.media.MediaRouter.RouteInfo#getPresentationDisplay() .

The following sample code from ApiDemos demonstrates how to use the media router to automatically switch between showing content in the main activity and showing the content in a presentation when a presentation display is available.

Java documentation for android.app.Presentation .

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Creates a new presentation that is attached to the specified display using the default theme.

Creates a new presentation that is attached to the specified display using the optionally specified theme.

A constructor used when creating managed representations of JNI objects; called by the runtime.

Retrieve the attached to this dialog, if present.

(Inherited from )

Returns the runtime class of this .

(Inherited from )

Retrieve the Context this Dialog is running in.

(Inherited from )

Call on the Window if this Activity to return the currently focused view.

(Inherited from )

Gets the that this presentation appears on.

The handle to the underlying Android instance.

(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )

Returns the instance associated with the window that this dialog is attached to.

(Inherited from )

Returns the Activity that owns this Dialog. -or- Sets the Activity that owns this dialog.

(Inherited from )
(Inherited from )

Gets the that should be used to inflate the layout of this presentation.

During the onSearchRequested() callbacks, this function will return the that triggered the callback, if it exists.

(Inherited from )

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

By default, this will use the owner Activity's suggested stream type.

(Inherited from )

Retrieve the current Window for the activity.

(Inherited from )

Add an additional content view to the screen.

(Inherited from )

Cancel the dialog.

(Inherited from )

Creates and returns a copy of this object.

(Inherited from )
(Inherited from )

Forces immediate creation of the dialog.

(Inherited from )

Dismiss this dialog, removing it from the screen.

(Inherited from )

Called to process generic motion events.

(Inherited from )

Called to process key events.

(Inherited from )

Called to process a key shortcut event.

(Inherited from )

Called to process population of s.

(Inherited from )

Called to process touch screen events.

(Inherited from )

Called to process trackball events.

(Inherited from )
(Inherited from )
(Inherited from )

Indicates whether some other object is "equal to" this one.

(Inherited from )

Finds the first descendant view with the given ID or if the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not yet been fully created (for example, via or ).

(Inherited from )
(Inherited from )

Returns a hash code value for the object.

(Inherited from )

Hide the dialog, but do not dismiss it.

(Inherited from )
(Inherited from )

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from )

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from )

Wakes up all threads that are waiting on this object's monitor.

(Inherited from )

To be added

(Inherited from )

To be added

(Inherited from )

Called when the window has been attached to the window manager.

(Inherited from )

Called when the dialog has detected the user's press of the back key.

(Inherited from )

This hook is called whenever the content view of the screen changes (due to a call to or ).

(Inherited from )
(Inherited from )
(Inherited from )

Similar to , you should initialize your dialog in this method, including calling .

(Inherited from )

Called when the context menu for this view is being built.

(Inherited from )

It is usually safe to proxy this call to the owner activity's if the client desires the same menu for this Dialog.

(Inherited from )

Initialize the contents of the menu for panel 'featureId'.

(Inherited from )

Instantiate the view to display in the panel for 'featureId'.

(Inherited from )

Called when the window has been attached to the window manager.

(Inherited from )

Called by the system when the properties of the to which the presentation is attached have changed.

Called by the system when the to which the presentation is attached has been removed.

Called when a generic motion event was not handled by any of the views inside of the dialog.

(Inherited from )

A key was pressed down.

(Inherited from )

Default implementation of : always returns false (doesn't handle the event).

(Inherited from )

Default implementation of : always returns false (doesn't handle the event).

(Inherited from )

Called when a key shortcut event is not handled by any of the views in the Dialog.

(Inherited from )

A key was released.

(Inherited from )

Called when a panel's menu item has been selected by the user.

(Inherited from )

Called when a panel's menu is opened by the user.

(Inherited from )
(Inherited from )
(Inherited from )

Called when a panel is being closed.

(Inherited from )

It is usually safe to proxy this call to the owner activity's if the client desires the same menu for this Dialog.

(Inherited from )

Prepare a panel to be displayed.

(Inherited from )

Restore the state of the dialog from a previously saved bundle.

(Inherited from )

Saves the state of the dialog into a bundle.

(Inherited from )

This hook is called when the user signals the desire to start a search.

(Inherited from )

This hook is called when the user signals the desire to start a search.

(Inherited from )

Called when the dialog is starting.

(Inherited from )

Called to tell you that you're stopping.

(Inherited from )

Called when a touch screen event was not handled by any of the views under it.

(Inherited from )

Called when the trackball was moved and not handled by any of the views inside of the activity.

(Inherited from )

This is called whenever the current window attributes change.

(Inherited from )

This hook is called whenever the window focus changes.

(Inherited from )

Called when an action mode is being started for this window.

(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )

Enable extended window features.

(Inherited from )

Finds the first descendant view with the given ID or throws an IllegalArgumentException if the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not yet been fully created (for example, via or ).

(Inherited from )

Sets whether this dialog is cancelable with the key.

(Inherited from )

Sets whether this dialog is canceled when touched outside the window's bounds.

(Inherited from )

Set a message to be sent when the dialog is canceled.

(Inherited from )

Set the screen content from a layout resource.

(Inherited from )

Set the screen content to an explicit view.

(Inherited from )

Set the screen content from a layout resource.

(Inherited from )

Set a message to be sent when the dialog is dismissed.

(Inherited from )

Convenience for calling .

(Inherited from )

Convenience for calling .

(Inherited from )

Convenience for calling .

(Inherited from )

Convenience for calling .

(Inherited from )

Sets the property.

(Inherited from )

Set a listener to be invoked when the dialog is canceled.

(Inherited from )

Set a listener to be invoked when the dialog is dismissed.

(Inherited from )

Sets the callback that will be called if a key is dispatched to the dialog.

(Inherited from )

Sets a listener to be invoked when the dialog is shown.

(Inherited from )

Set the title text for this dialog's window.

(Inherited from )

Set the title text for this dialog's window.

(Inherited from )

Set the title text for this dialog's window.

(Inherited from )

Start the dialog and display it on screen.

(Inherited from )

Request that key events come to this dialog.

(Inherited from )
(Inherited from )

Returns a string representation of the object.

(Inherited from )
(Inherited from )
(Inherited from )

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from )

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from )

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )

Explicit Interface Implementations

(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )
(Inherited from )

Extension Methods

Performs an Android runtime-checked type conversion.

Additional resources

Screen Mirroring ¶

With Connect SDK integrated in the mobile app, it can cast the screen and sound into the TV screen. This allows you to extend the screen of a mobile app to a larger TV screen and share it with your family. This guide assumes that you completed the setup described in the Setup Instructions .

There are two ways to display the screen to your TV.

  • Screen mirroring: A way to dispay the entire app screen to the TV.
  • Dual screen: A way to create a second screen of the app and display it on the TV while leaving the app screen separate. Dual screen is provided as a screen mirroring function.

This feature is only supported on webOS TV 22.

How to Use Screen Mirroring ¶

To use screen mirroring, follow these steps.

1. Check the Android Version ¶

Screen mirroring runs on Android version 10 (Q, API Level 29) and higher, so you need to check the OS version when starting the app. If the OS version does not support the screen mirroring function, the function will not work or the app will close.

2. Search Devices ¶

Search for devices (TVs) connected to your home network. You can set the filter to only search for TVs that support the screen mirroring function. Since the search for TVs takes some time, it should be started as soon as the app is running.

3. Request Permissions ¶

The screen mirroring requires the audio permission (android.permission.RECORD_AUDIO). The permission agreement is executed only once on the first run or when there is no permission.

4. Get User Approval for Screen Capture ¶

User approval is required to capture the screen. Intent data must be delivered to the screen mirroring API when consenting to screen capture.

5. Select a TV ¶

Select the TV to run the screen mirroring on by using the Picker. After selecting a TV, get a ScreenMirroringControl object to use the screen mirroring API.

6. Start Screen Mirroring ¶

Now you can run the screen mirroring. Pairing is required when you connect to a TV for the first time, and the user is informed about this.

The following runtime errors might occur while the screen mirroring is running.

When the network connection is terminated When the TV is turned off When the screen mirroring is terminated on the TV When the mobile device’s notification terminates the screen mirroring When other exceptions occurred

For these errors, it is necessary to receive the error in real-time through the listener and respond appropriately.

7. Stop Screen Mirroring ¶

When you want to stop mirroring, call stopScreenMirroring.

How to Use Dual Screen ¶

Dual screen is a function that creates a second screen, separate from the app screen, and displays it on the TV. The basic procedure is the same as with the screen mirroring above, and only the differences are explained below. When mirroring starts, you just need to deliver the user-defined second screen class.

Define Second Screen ¶

Inherit Android Presentation class to define a second screen class for dual screen.

Start Dual Screen ¶

Dual screen starts mirroring the screen by using the user-defined, Presentation inherited class. When the mobile device is connected to the TV, it creates a virtual display for the second screen, creates an instance of the second screen class, and passes it to the onStart callback. The user can then access the Second Screen class to control the dual screen.

DEV Community

DEV Community

Aspose.Slides profile image

Posted on Nov 29, 2019

Create presentation viewer for your Android📱 [use case]

I will show how to create your own mobile presentation viewer with Aspose.Slides API for Android .

This is the first article in a series , where I will pass you through some trivial and non-trivial scenarious, like: edit and convert presentation from mobile; upload presentation as a web application or add it to Aspose Cloud Storage ; share presentation in various formats; generate unique presenation key; and many others.

Please stay tuned and share which other cases you are interested to see.👇

Presentation viewer for Android:

So, let us start with the first step - basic presentation viewer!👩‍💻

I will pass you through the key points, while you can find the whole project on GitHub .

Open Android Studio .

Install latest Aspose.Slides API for Android.

Define Main Layout with btnOpenPresentation button, or just take it from link. My lookes simply this way:

presentation class android

Create Main Activity and add this code to onCreate method, which will launch Presentation Activity by btnOpenPresentation click:

Create Presentation Layout with slides’ carousele and a control to show the current slide, or just take it from link. My looks simply this way, but there is a lot of space to show creativity here👩‍🎨. Actually, this is a final application we should get:

presentation class android

Create Presentation Activity . Now, let us stop more detailed.

Define execFilePicker() method and call it from onCreate() in Presentation Activity. This method will open the file system, that we could choose the presentation file this way:

presentation class android

All this is done just in 3 lines:

Note that we’ve passed READ_REQUEST_CODE to startActivityForResult method. We will use it to check activity result in onActivityResult method and know if we can load the presentation chosen:

In previous method we’ve called execLoadPresentation method to load chosen presentation. Then selectSlide method can be called to select the slide of the presentation, which should be shown on Presentation Layout.

Now lets create LoadPresentationTask and SelectSlideTask classes used in two previous methods.

LoadPresentationTask will do the following:

  • doInBackground - set the presenation, choosed by user, as the current one.

SelectSlideTask will do the following:

  • doInBackground - select the slide of presentation to be shown on Presentation Layout.

These tasks refer to presentationActivity.app. setPresentation() and presentationActivity.app. selectSlide() , where presentationActivity.app - is the instance of SlidesApp class, which manages all logic about Presentation and Slide objects.

In the end, we came to the main part of the story.👩‍🏫 ❗️THE MAGIC STARTS HERE!❗️

SlidesApp class incapsulates all the logic to work with Aspose.Slides API for Android . This class will allow us to locally save presentation, get all slides, set current slide, convert it into the thumbnail, calculate thumbnail’s size, etc.

Import IPresentation , ISlide , ISlideCollection types:

Add SlidesApp class with the instances of current presentation and current slide:

Now lets implement selectSlide method, that will call getSlides to retrieve all presentation slides, then get the slide needed by its id. And, get the thumbnail of the slide with getThumbnail method.

The thumbnail is saved into currSlide property and returned back into SelectSlideTask, which will draw it on Presentation Layout:

I have shown you how to developer a basic presentation viewer, while there are a lot of features you can easily add to this application with Aspose.Slides API for Android to edit, convert or manage presentation or a certain slide. Check it out here .👈

Top comments (0)

pic

Templates let you quickly answer FAQs or store snippets for re-use.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink .

Hide child comments as well

For further actions, you may consider blocking this person and/or reporting abuse

insideee_dev profile image

Customizing Your Lazyvim Setup for Personal Preferences

insideee.dev - Jun 30

hirelaraveldevelopers profile image

Affordable WordPress Development: Tips for Hiring Quality Developers on a Budget

Hire Laravel Developers - Jul 4

devabdul profile image

Building a Simple To-Do List App with React 🚀

Abdul Haseeb - Jul 13

iarchitsharma profile image

Top 10 Popular Terraform Interview Questions

Archit Sharma - Jul 12

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Javatpoint Logo

  • Design Pattern

Android Tutorial

Android widgets, activity and intents, android fragments, android menu, android service, android alarmmanager, android storage, android sqlite, xml and json, android multimedia, android speech, android telephony, android device, camera tutorial, sensor tutorial, android graphics, android animation, android web service, android examples, android social, android versions, android misc, android mcq, android interview, android quiz.

JavaTpoint

Android tutorial or Android Studio tutorial covers basic and advanced concepts of android technology. Our Android development tutorial is developed for beginners and professionals.

is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes etc.

It contains a , and .

It can be thought of as a mobile operating system. But it is not limited to mobile only. It is currently used in various devices such as mobiles, tablets, televisions etc.

To learn Android Studio, you must have the basic knowledge of Java programming language.

Our Android tutorial is designed to help beginners and professionals.

We assure that you will not find any problem in this Android Studio tutorial. However, if there is any mistake, please post the problem in the contact form.





Youtube

  • Send your Feedback to [email protected]

Help Others, Please Share

facebook

Learn Latest Tutorials

Splunk tutorial

Transact-SQL

Tumblr tutorial

Reinforcement Learning

R Programming tutorial

R Programming

RxJS tutorial

React Native

Python Design Patterns

Python Design Patterns

Python Pillow tutorial

Python Pillow

Python Turtle tutorial

Python Turtle

Keras tutorial

Preparation

Aptitude

Verbal Ability

Interview Questions

Interview Questions

Company Interview Questions

Company Questions

Trending Technologies

Artificial Intelligence

Artificial Intelligence

AWS Tutorial

Cloud Computing

Hadoop tutorial

Data Science

Angular 7 Tutorial

Machine Learning

DevOps Tutorial

B.Tech / MCA

DBMS tutorial

Data Structures

DAA tutorial

Operating System

Computer Network tutorial

Computer Network

Compiler Design tutorial

Compiler Design

Computer Organization and Architecture

Computer Organization

Discrete Mathematics Tutorial

Discrete Mathematics

Ethical Hacking

Ethical Hacking

Computer Graphics Tutorial

Computer Graphics

Software Engineering

Software Engineering

html tutorial

Web Technology

Cyber Security tutorial

Cyber Security

Automata Tutorial

C Programming

C++ tutorial

Control System

Data Mining Tutorial

Data Mining

Data Warehouse Tutorial

Data Warehouse

RSS Feed

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Sample code from the Android 'patterns & practices' presentation. Contains examples of dependency injection, RxJava, Retrofit, unit tests, and integration tests.

ThomasJones/android-presentation-sample

Folders and files.

NameName
5 Commits
wrapper wrapper

Repository files navigation

Android-presentation-sample.

Sample code from the Android 'patterns & practices' presentation. Contains examples of dependency injection, RxJava, Retrofit, JUnit4 unit tests, and Android integration tests.

  • Java 100.0%
  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

Set presentationDisplay Orientation programmatically

The app I am working on will have 2 displays. Using the DisplayManager I am casting my presentation to a second screen.

I want to find a way to set the orientation of my presentation class to landscape and my activity class to portrait. Code bellow called onCreate of activity to render the presentation.

The code works perfectly and the display gets rendered correctly. I just want to know if its possible to flip the orientation of the presentation class without changing the orientation of the activity

Brendan Van Der Merwe's user avatar

I ended up just grabbing the layout and rotating it. See code below

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged android or ask your own question .

  • Featured on Meta
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network...
  • Announcing a change to the data-dump process
  • What makes a homepage useful for logged-in users

Hot Network Questions

  • "commit" a crime
  • How does BackProp avoid bias for the last input used for training?
  • Ignore higher order terms in an expression
  • Sorting with a deque
  • Does an attack still succeed if the target is immune to the condition?
  • Unlisted plane crash site in wilderness
  • What is the Delta Flyer's top warp speed?
  • Clock that is twice as fast
  • Ideas for cooling a small office space with direct sunlight
  • Had there ever been a plane crash caused by flying too high and exploding?
  • Excel in both teaching and research as a junior faculty member
  • What is the difference between "Donald Trump just got shot at!" and "Donald Trump just got shot!"?
  • Formal written form for a 2x something?
  • Team member working from home is distracted with kids while on video calls - should I say anything as her manager?
  • How do cache-timing attacks determine the secret keys of encryption algorithms?
  • How to choose a textbook that is Pedagogically Optimal for oneself?
  • 80s live-action short film with a labyrinth/elf/handprint/minotaur
  • Need help deciphering word written in Fraktur
  • Cost of Living/Salary: Sweden vs Germany
  • Can Falcon Heavy be used as a temporary replacement for the Falcon 9?
  • Does quick review means likely rejection?
  • GUI Interface for a command line program in C# Windows Forms
  • How can I condense my bash script to look for 42 extensions in a directory
  • Zugzwang where the side to move must be mated in exactly 2 moves

presentation class android

IMAGES

  1. PPT: Android PPT Template (21-slide PPT PowerPoint presentation)

    presentation class android

  2. Android presentation

    presentation class android

  3. Android Presentation

    presentation class android

  4. Android PowerPoint Presentation

    presentation class android

  5. Android Presentation

    presentation class android

  6. Android PPT Presentation 2018

    presentation class android

VIDEO

  1. Advanced layout concepts

  2. Presentation Class 1!

  3. Presentation Class Certificates

  4. Class presentation #presentation #retail #learning

  5. 53 नंबर वाली कॉपी / ऐसी गलती न करना/ Board Exam copy By pathak sir

  6. Урок № 1.2. Slideshare работа со слайд презентациями в Android

COMMENTS

  1. Presentation

    Presentation | Android Developers. Essentials. Build AI experiences. Build AI-powered Android apps with Gemini APIs and more. Get started. Get started. Start by creating your first app. Go deeper with our training courses or explore app development on your own. Hello world.

  2. screen

    public class MainActivity extends Activity { private PresentationActivity presentationActivity; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // init Presentation Class DisplayManager displayManager = (DisplayManager) this.getSystemService(Context.DISPLAY_SERVICE); Display[] presentationDisplays ...

  3. Secondary Display Control via Android Presentation Class

    Presentation Class. A presentation is a special kind of dialog whose purpose is to present content on a secondary display. A Presentation is associated with the target Display at creation time and configures its context and resource configuration according to the display's metrics. — developer.android.com

  4. Presentation

    android.app.Presentation: Class Overview. Base class for presentations. A presentation is a special kind of dialog whose purpose is to present content on a secondary display. A Presentation is associated with the target Display at creation time and configures its context and resource configuration according to the display's metrics.

  5. Android Presentation tutorial with examples

    Android Presentation tutorial with examples Previous Next. Base class for presentations. Introduction Base class for presentations. A presentation is a special kind of dialog whose purpose is to present content on a secondary display.

  6. Multi-screen management within Android

    A Presentation is a special kind of dialog whose purpose is to present content on another display. But … the Presentation class inherits from the old android.app.Dialog 😱, say bye-bye to DialogFragment 👋. Display your first screen. In this part, we will learn how to show a screen on the secondary display. So Presentation is a kind of ...

  7. 2020 Guide to Implementing Model-View-Presenter Architecture in Android

    Model-View-Presenter(MVP) is a humble architecture pattern that has become the de-facto architecture pattern until Model-View-ViewModel(MVVM) was introduced by Google.

  8. core/java/android/app/Presentation.java

    * @see android.media.MediaRouter#ROUTE_TYPE_LIVE_VIDEO for information on about live * video routes and how to obtain the preferred presentation display for the * current media route. * @see DisplayManager for information on how to enumerate displays and receive * notifications when displays are added or removed. */ public class Presentation ...

  9. Teach Android Development

    The course is 13 lessons long with each lecture being approximately 1 hour long. Each lecture is accompanied by 2 hours of hands-on codelabs for learners to complete on their own. If you're ready to start teaching Android, use these materials to get started today. We have lessons covering the Kotlin language, introduction to Android ...

  10. Handle multi-touch gestures

    When multiple pointers tap the screen at the same time, the system generates the following touch events: ACTION_DOWN : sent when the first pointer taps the screen. This starts the gesture. The pointer data for this pointer is always at index 0 in the MotionEvent. ACTION_POINTER_DOWN : sent when extra pointers enter the screen after the first.

  11. Using the Presentation API and external screens on Android

    Xavier Hallade. Follow. This document discusses adding multi-screen support to Android applications using the Presentation API. It describes various connection methods like Miracast, HDMI, and Chromecast Mirroring. It provides examples of using the Presentation API to display content on an external screen independently of the phone screen.

  12. Presentation Class (Android.App)

    Remarks. Base class for presentations. A presentation is a special kind of dialog whose purpose is to present content on a secondary display. A Presentation is associated with the target Display at creation time and configures its context and resource configuration according to the display's metrics.. Notably, the Context of a presentation is different from the context of its containing Activity.

  13. Google Slides: Presentation Slideshow Maker

    Bring your presentations to life in Google Slides with enhancements like videos, animations, smooth transitions, and more. Get started with templates Choose from an array of high-quality pre-designed templates with different layouts, images, colors, and fonts.

  14. Screen Mirroring

    Check the Android Version ... Presentation inherited class. When the mobile device is connected to the TV, it creates a virtual display for the second screen, creates an instance of the second screen class, and passes it to the onStart callback. The user can then access the Second Screen class to control the dual screen.

  15. Create presentation viewer for your Android [use case]

    I will show how to create your own mobile presentation viewer with Aspose.Slides API for Android.. This is the first article in a series, where I will pass you through some trivial and non-trivial scenarious, like: edit and convert presentation from mobile; upload presentation as a web application or add it to Aspose Cloud Storage; share presentation in various formats; generate unique ...

  16. Learn Android Tutorial

    Our Android development tutorial is developed for beginners and professionals. Android is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes etc. It contains a linux-based Operating System, middleware and key mobile applications.

  17. How to mirror a fragment to a presentation in Android?

    Step #1: Convert your "one specific fragment" to be a subclass of MirroringFragment. Quoting the documentation: MirroringFragment works much like a regular Fragment. However, instead of overriding onCreateView (), you override onCreateMirroredContent (). onCreateMirroredContent () takes the same parameters as does onCreateView (), and your job ...

  18. ThomasJones/android-presentation-sample

    Sample code from the Android 'patterns & practices' presentation. Contains examples of dependency injection, RxJava, Retrofit, unit tests, and integration tests. Resources. Readme Activity. Stars. 2 stars Watchers. 1 watching Forks. 2 forks Report repository Releases No releases published. Packages 0 . Languages.

  19. android

    I want to find a way to set the orientation of my presentation class to landscape and my activity class to portrait. Code bellow called onCreate of activity to render the presentation. // Get the display manager service. mDisplayManager = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE); Display[] presentationDisplays = mDisplayManager ...