android / tv-samples Goto Github PK
View Code? Open in Web Editor NEWMultiple samples showing best practices in app development on Android TV.
License: Apache License 2.0
Multiple samples showing best practices in app development on Android TV.
License: Apache License 2.0
Exoplayer natively supports ad playback along handling SeekBar
and other UI elements. However, UI elements are not handled properly when using leanback components like PlaybackSupportFragment
and PlayerAdapter
to implement playback with Exoplayer. There is no working sample code to demonstrate how to correctly implement Exoplayer ad playback with leanback components.
Showcase app provides some example implementations of playback with Exoplayer but ad support is not implemented.
Dependency injection needs to be fixed for the Activity and Fragment, but the version of Dagger is also very old, so we need to investigate whether it makes sense to update to a newer version or move away from dependency injection.
FATAL EXCEPTION: main
Process: com.example.android.persistence, PID: 22860
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.persistence/androidx.leanback.leanbackshowcase.app.room.controller.overview.LiveDataRowsActivity}: java.lang.IllegalArgumentException: No injector factory bound for Class<androidx.leanback.leanbackshowcase.app.room.controller.overview.LiveDataRowsActivity>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.IllegalArgumentException: No injector factory bound for Class<androidx.leanback.leanbackshowcase.app.room.controller.overview.LiveDataRowsActivity>
at dagger.android.DispatchingAndroidInjector.inject(DispatchingAndroidInjector.java:136)
at dagger.android.AndroidInjection.inject(AndroidInjection.java:59)
at androidx.leanback.leanbackshowcase.app.room.controller.overview.LiveDataRowsActivity.onCreate(LiveDataRowsActivity.java:52)
at android.app.Activity.performCreate(Activity.java:7817)
at android.app.Activity.performCreate(Activity.java:7806)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Hello,
I designed my app following all the rules from documentation and also I took examples from here, but Google Console keeps rejecting my app and I don't have enough details. Maybe you have any idea how can I know what is the problem or how to solve it?
Not designed in landscape orientation
Your app or game has vertical letterboxing when displayed on TVs. Please design your TV app or game to be displayed in landscape mode. Please refer to our TV Layouts documentation for more details.
All the pages are force to be landscape and I used AndroidX Leanback library
I really need help or any suggestion, please. I have had this problem for more than 5 months.
Thanks in advance.
There was sound, but no image to show
Hi,
I'm trying to use a VerticalGridSupportFragment to display cards that only show the info when selected.
I loaded the LeanbackShowCase, and added the <item name="infoVisibility">selected</item>
to the GridCardStyle.
When running the app the grid shows an weird behaviour when selecting a card, the rows below moves down, and sometimes the cards change order.
Is there an way to prevent the rows below from moving down and keep the items in the same position?
Thanks in advance
Hello,
I would like to know how can we customize HeadersFragment or make it look like YouTube or Google Play Music application?
For example in Google Play Music, when MainFragment is focused, HeadersFragment appears with icons only. I guess there is maybe some workaround because in HeadersFragment there is no such option to show icons only when MainFragment focused.
The current implementation of MusicConsumptionFragment
in leanback-showcase uses deprecated MediaPlayerGlue
. Need help in implementing MediaPlayerAdapter
with PlaybackTransportControlGlue
There is not much in documentation, or articles, videos on developing TV apps. Most of the help we find online is for playing video but not much for audio.
How can we convert MusicConsumptionFragment to modern Kotlin like in classic kotlin case.
I cant understand how to use MediaPlayerAdapter
with PlaybackTransportControlGlue
extending PlaybackSupportFragment
to get the UI similar to MusicConsumptionFragment
where one has CoverPhoto, title, description and a list of rows for episodes with like and add to playlist action
Since leanback style automatically sets the buttons to textAllCaps, talkback reads it letter-by-letter instead of a whole word.
Possible solutions:
It suppose back to the SettingsExampleFragment, but it back to MainFragment in Android Pie and Android Q. The lower android version is normal.
Hi,
All the media files in media-feed.json of ClassicsKotlin returns 404, e.g.
https://android-tv-classics.firebaseapp.com/content/buffalo_dance/poster_art_buffalo_dance.jpg
This broke the sample app.
Hope this isn't a stupid issue but:
I'm under the impression that media keys functionality are automatic with leanback, however I've been having issues with it in my own project and also with the Leanback project.
When running the Leanback project in an emulator and on real hardware, I've noticed that the play/pause buttons function but others don't (at least the fast forward and rewind buttons on both, i've also tried the stop button on real hardware and that also does nothing)
Is this wrong, or is support not included automatically and I'm missing some implementation step
Hi All,
I am using the lenabck grid with for TV app. I have nested Horizontalgird view inside Vertical GridView.
When scroll happens and next card gets focus i am calling the scrollToPosition based on scroll direction either on Horizontalgird or verticalgrid to show a constant scroll.
Scrolling works fine if i add padding to the the focus view
view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
v.setPadding(1,0,0,0);
TitleCardViewHolder.this.carouselItemAdapter.scrollToPosition(getLayoutPosition());
}else {
v.setPadding(0,0,0,0);
}
}
});**
```**
If i remove the line v.setPadding(1,0,0,0); then scrollToPosition does not work at all
Why it is required to add padding to make scrollToPosition work
Hi Android Team
I am a developer from OEM Hisense,
Right now I am testing tv-amples leanback function in Android TV Platform (including Amlogic S905,Realtek 1319 chipset),
I found that searchable function not ok in ATV 10.0,
after add log in com.example.android.tvleanback.data.VideoProvider.java line:161 query ,
and click search funtion in ATV Launcher ,I have got nothing log output,
Can you help to check this function?
ATV Pie is OK,
Thank you.
The documentation tells:
Make your default channel appear before your app is opened. You can make this behavior happen by adding a BroadcastReceiver that listens for the android.media.tv.action.INITIALIZE_PROGRAMS action, which the home screen sends after the app is installed
I've put a log cat on the TvLauncherReceiver::onReceive() just to sense when it is being triggered. But after a fresh installation, this log cat is never triggered. But the default channel appears on the home screen
I tried to add subtitleSource and merge it with videoSource when I use it with XML layout to display the player it works fine, but with the VideoSupportFragment and VideoPlayerGlue, it's not displaying any subtitles.
val userAgent = Util.getUserAgent(activity, "Demo")
val dataSourceFactory = DefaultDataSourceFactory(
activity,
userAgent, bandwidthMeter)
val mediaSourceUri = Uri.parse("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")
val videoSource = ExtractorMediaSource.Factory(dataSourceFactory)
.createMediaSource(mediaSourceUri)
val subtitleFormat = Format.createTextSampleFormat(
null,
MimeTypes.APPLICATION_SUBRIP,
Format.NO_VALUE,
"en"
)
val subUri = Uri.parse("https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt")
val fac = DefaultDataSourceFactory(activity, userAgent)
val subtitleSource = SingleSampleMediaSource.Factory(fac)
.createMediaSource(subUri, subtitleFormat, C.TIME_UNSET)
val mergedSource = MergingMediaSource(videoSource, subtitleSource)
mPlayer?.prepare(mergedSource)
mPlayerGlue?.play()
any ideas why it's not displaying the subtitles?
How to make the exoplayer to play the video automatically instead of pressing enter or ok button in D-pad while forwarding the video using seekbar?
Hello,
Reference app:
Android TV application created by Android Studio via File / New / New Application / Android TV Activity. Android studio 3.6.
Issue:
When mouse is connected to STB and user wants to swipe in the HorizontalGridView (RowFragment), the content gets out of window and then returns back.
The same issue is happening when application is running on mobile device and user wants to swipe the list quickly.
Is it possible to swipe the HorizontalGridView by mouse or touch screen without this behavior?
Thank you in advance!
I was trying to run the project at Android Studio 4.1.1 but it's got a runtime exception.
2020-11-25 06:51:44.422 30804-30854/com.android.tv.classics E/TvLauncherUtils: Unable to publish channel java.io.IOException: Failed to add logo, so channel (ID=51) was not created at androidx.tvprovider.media.tv.PreviewChannelHelper.publishChannel(PreviewChannelHelper.java:136) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel(TvLauncherUtils.kt:222) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel$default(TvLauncherUtils.kt:157) at com.android.tv.classics.workers.TvMediaSynchronizer$Companion.synchronize(TvMediaSynchronizer.kt:165) at com.android.tv.classics.fragments.MediaBrowserFragment$onCreate$4.invokeSuspend(MediaBrowserFragment.kt:158) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740) 2020-11-25 06:51:44.448 30804-30854/com.android.tv.classics E/PreviewChannel: Logo for preview channel (ID:12) not found. java.io.FileNotFoundException: content://android.media.tv/channel/12/logo at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:149) at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705) at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1687) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1503) at android.content.ContentResolver.openInputStream(ContentResolver.java:1187) at androidx.tvprovider.media.tv.PreviewChannel.getLogo(PreviewChannel.java:175) at androidx.tvprovider.media.tv.PreviewChannelHelper.addChannelLogo(PreviewChannelHelper.java:268) at androidx.tvprovider.media.tv.PreviewChannelHelper.updatePreviewChannel(PreviewChannelHelper.java:234) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel(TvLauncherUtils.kt:212) at com.android.tv.classics.utils.TvLauncherUtils$Companion.upsertChannel$default(TvLauncherUtils.kt:157) at com.android.tv.classics.workers.TvMediaSynchronizer$Companion.synchronize(TvMediaSynchronizer.kt:165) at com.android.tv.classics.fragments.MediaBrowserFragment$onCreate$4.invokeSuspend(MediaBrowserFragment.kt:158)
Hi Team,
I want to save the audio that google recognition service used for speech to text operation. I followed a stackoverflow post and built an test app for this which works on Android phones. But the same app on Android TV/STB doesn't work. The intention is to validate the audio coming from the remote that is used for Google voice search.
So I used "android.speech.extra.GET_AUDIO_FORMAT" and "android.speech.extra.GET_AUDIO" to dump an .amr file, which also creates an URI. I can save the data from URI for my validation.
But this works perfectly on Android phone which uses com.google.android.googlequicksearchbox, but on Android STB, com.google.katniss is available and katniss doesn't upload audio to myactivity.google nor it dump/generates URI for audio.
My question is there any other extra parameter that I need to pass to RecognizerIntent to get the audio?
Here is my code snippet:
public void startSpeechRecognition() {
// Fire an intent to start the speech recognition activity.
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
// secret parameters that when added provide audio url in the result
intent.putExtra("android.speech.extra.GET_AUDIO_FORMAT", "audio/AMR");
intent.putExtra("android.speech.extra.GET_AUDIO", true);
startActivityForResult(intent, "<some code you choose>");
}
// handle result of speech recognition
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
Log.d("URI", data.toString());
Log.d("URI", ""+requestCode);
Log.d("URI", ""+resultCode);
Uri audioUri = data.getData();
ContentResolver contentResolver = getContentResolver();
InputStream filestream = null;
try {
filestream= contentResolver.openInputStream(audioUri);
} catch (FileNotFoundException e) {
Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
String filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/rec1.amr";
byte[] buffer = new byte[0];
try {
buffer = new byte[filestream.available()];
filestream.read(buffer);
OutputStream outStream = new FileOutputStream(filePath);
outStream.write(buffer);
} catch (IOException | NullPointerException e) {
Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
Bundle bundle = data.getExtras();
// Populate the wordsList with the String values the recognition engine thought it heard
final ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (!matches.isEmpty()) {
String Query = matches.get(0);
ed.setText(Query);
//speak.setEnabled(false);
}
}
super.onActivityResult(requestCode, resultCode, data);
}
I logged Intent data and here is the result from phone and TV:
TV/STB:
C:\Users\AndroidStudioProjects\voice\app\build\outputs\apk\debug>adb logcat | findstr URI
08-27 13:32:25.915 11353 11353 D URI : Intent { (has extras) }
08-27 13:32:25.915 11353 11353 D URI : 1234
08-27 13:32:25.915 11353 11353 D URI : -1
Android Phone:
C:\Users\AndroidStudioProjects\voice\app\build\outputs\apk\debug>adb -d logcat | findstr URI
08-27 13:33:22.585 24064 24064 D URI : Intent { dat=content://com.google.android.googlequicksearchbox.AudioRecordingProvider/my_recordings/recording.amr flg=0x1 (has extras) }
08-27 13:33:22.585 24064 24064 D URI : 1234
08-27 13:33:22.585 24064 24064 D URI : -1
So from above we can see STB/TV is not retuning audio URI.
Both devices are running Android 9 with latest speech recognition apps.
Is it not possible to save audio on TV/STB?
Thanks!
do not supprot AsyncListDiffer? Maybe we can use AsyncListDiffer instead of DiffUtil.calculateDiff in Leanback.
When changing setHeadersState(HEADERS_ENABLED) to setHeadersState(HEADERS_DISABLED) on MainFragment.java, nothing is shown except for the logo and the search icon. I believed this is an issue w/ using the androidx.leanback library. Before migrating to use androidx leanback, the header can be disabled w/o affecting the main content. Any idea how to disable the header and still show the contents?
Hi! I'm using a BrowseSupportFragment with PageRow, meaning that every item in the menu is a fragment. I have other activities where I show detail pages and the player. Is there a way to use the navigation components and have a single activity in Leanback while still using BrowseSupportFragment.
If so could you provide an example? This would be something similar to DrawerLayout which supports the navigation component.
If this is not possible, would it be possible to use with the new LeanbackTabLayout?
I'm copying this from the previous repo as it was closed before an answer was provided.
I want to have a VerticalGridView with cards of different width. Something like this:
█ █ █ █
███ ███
█ █ █ █
█████ █
█ █ █ █
With regular support libraries, I'm able to use GridLayoutManager.SpanSizeLookup for this scenario.
Leanback seems to have it's own implementation of GridLayoutManager, but it it doesn't support the setSpanSizeLookup method, and even if it did, the manager is set and configured very early in the fragment, so just replacing it with another will cause issues, because it doesn't get configured as expected.
Is there any way to solve this and be able to specify how many columns should each element in the grid take?
CI Build file '.../ClassicsKotlin/app/build.gradle' line: 18
Failed to apply plugin [id 'kotlin-android']
The current Gradle version 5.4.1 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1 or newer, or the previous version of the Kotlin plugin.
How to implement imaadsloader with the exoplayer example here.
I would like to know how to customize the headers fragment if I want to create similar navigation slide menu for android tv app and also at top of header fragment screen, it should be profile icon and user name on it.
Hello,
I was running the LeanbackShowcase app in an Android 10 (or Q) emulator.
Suddently when I have clicked on the Settings item, the app just crashed with the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.persistence, PID: 15502
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.persistence/androidx.leanback.leanbackshowcase.app.settings.SettingsExampleActivity}: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3102)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3237)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1929)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:209)
at android.app.ActivityThread.main(ActivityThread.java:7021)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:486)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:872)
Caused by: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class fragment
Caused by: java.lang.IllegalStateException: Fragment androidx.leanback.leanbackshowcase.app.settings.SettingsExampleFragment.PrefFragment must be a public static class to be properly recreated from instance state.
at android.app.BackStackRecord.doAddOp(BackStackRecord.java:429)
at android.app.BackStackRecord.add(BackStackRecord.java:419)
at androidx.leanback.preference.LeanbackSettingsFragment.startPreferenceFragment(LeanbackSettingsFragment.java:153)
at androidx.leanback.leanbackshowcase.app.settings.SettingsExampleFragment.onPreferenceStartInitialScreen(SettingsExampleFragment.java:38)
at androidx.leanback.preference.LeanbackSettingsFragment.onViewCreated(LeanbackSettingsFragment.java:78)
at android.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManager.java:1496)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1274)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1486)
at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1728)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3562)
at android.app.FragmentController.onCreateView(FragmentController.java:104)
at android.app.Activity.onCreateView(Activity.java:6804)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:987)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:917)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:881)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1041)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1002)
at android.view.LayoutInflater.inflate(LayoutInflater.java:665)
at android.view.LayoutInflater.inflate(LayoutInflater.java:517)
at android.view.LayoutInflater.inflate(LayoutInflater.java:464)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:429)
at android.app.Activity.setContentView(Activity.java:3238)
at androidx.leanback.leanbackshowcase.app.settings.SettingsExampleActivity.onCreate(SettingsExampleActivity.java:28)
at android.app.Activity.performCreate(Activity.java:7650)
at android.app.Activity.performCreate(Activity.java:7639)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1295)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3077)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3237)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1929)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:209)
at android.app.ActivityThread.main(ActivityThread.java:7021)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:486)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:872)
More than one file was found with OS independent path 'error_prone/Annotations.gwt.xml
For some devices that don't have microphones (Vestel 17OPS15, Zappiti 4K HDR etc...), the SpeechRecognizer service is causing my app to crash when using a SearchSupportFragment().
I don't have any logic regarding Voice recognition in my own code, the problem is caused by the releaseRecognizer()
method called in onPause() :
Caused by java.lang.IllegalArgumentException: Service not registered: android.speech.SpeechRecognizer$Connection@3cde2b3d at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1029) at android.app.ContextImpl.unbindService(ContextImpl.java:1808) at android.content.ContextWrapper.unbindService(ContextWrapper.java:551) at android.speech.SpeechRecognizer.destroy(SpeechRecognizer.java:408) at androidx.leanback.app.SearchSupportFragment.releaseRecognizer(SearchSupportFragment.java:440) at androidx.leanback.app.SearchSupportFragment.onPause(SearchSupportFragment.java:416)
This issue is a more or less a duplicate of an issue opened in the old androidtv-leanback repo, I wanted to know if any progress has been made regarding this problem, would it be simpler for me to open an issue on the Issuetracker ?
I'm using androidx.leanback:leanback:1.0.0
Hi,
I'm using font-family in styles but it's not working, how can I use custom fonts in BrowseSupportFragment?
I think I must switch to calligraphy library 🤦
Thanks for your support
After I added a textView to the lb_fullwidth_details_overview_logo.xml
the poster loses its position.
this is the code I used to override lb_fullwidth_details_overview_logo.xml
:
<?xml version="1.0" encoding="utf-8"?><!-- This is an override of the full width details overview logo layout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/container"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/details_overview_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:elevation="@dimen/lb_details_overview_z"
android:maxHeight="@dimen/lb_details_v2_logo_max_height"
android:maxWidth="@dimen/lb_details_v2_logo_max_width" />
<TextView
android:id="@+id/statusText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
this is my Custom ViewHolder class:
class DetailsOverviewCardView(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : BaseCardView(context, attrs, defStyleAttr) {
val imageView: ImageView
val statusText: TextView
init {
val binding =
LbFullwidthDetailsOverviewLogoBinding.inflate(LayoutInflater.from(context), this, true)
imageView = binding.detailsOverviewImage
statusText = binding.statusText
}
}
and this is my CustomDetailsOverviewLogoPresenter class:
class CustomDetailsOverviewLogoPresenter(private val entitlementStatus: String) :
DetailsOverviewLogoPresenter() {
internal class ViewHolder(view: View?) :
DetailsOverviewLogoPresenter.ViewHolder(view) {
override fun getParentPresenter(): FullWidthDetailsOverviewRowPresenter {
return mParentPresenter
}
override fun getParentViewHolder(): FullWidthDetailsOverviewRowPresenter.ViewHolder {
return mParentViewHolder
}
}
override fun onCreateViewHolder(parent: ViewGroup): Presenter.ViewHolder {
val cardView = DetailsOverviewCardView(parent.context)
val width: Int = ViewGroup.LayoutParams.WRAP_CONTENT
val height: Int = ViewGroup.LayoutParams.WRAP_CONTENT
cardView.layoutParams = MarginLayoutParams(width, height)
return ViewHolder(cardView)
}
override fun onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any) {
val row = item as DetailsOverviewRow
val cardView = viewHolder.view as DetailsOverviewCardView
val imageView = cardView.imageView
val status = cardView.statusText
status.text = entitlementStatus
imageView.setImageDrawable(row.imageDrawable)
if (isBoundToImage(viewHolder as ViewHolder, row)) {
viewHolder.parentPresenter.notifyOnBindLogo(viewHolder.parentViewHolder)
}
}
}
but the result is like this:
I appreciate it if you help me with this problem.
Hi, i'm using RowsSupportFragment to have multiple rows on a fragment with presenters.
For one of the rows i want it to be like a verticalgridfragment (multiple rows and columns of items).
The effect i want is the one in row3:
|----------------------------|
| Row 1 |
| Item Item ... Item |
| |
| Row 2 |
| Item Item ... Item |
| |
| Row 3 |
| Item Item ... Item |
| Item Item ... Item |
| Item Item ... Item |
| Item Item ... Item |
-----------------------------
I've seted the num of rows of the List row presenter to 6, it presents multiple rows, but when i scroll down the fragment does not scroll to show the rows that are not visible, like it does when i scroll to a different ListRow.
Is there anyway to do it?
Thanks in advance
can any one help me to solve this error its flutter android tv app.
Missing DPad functionality
Your app requires user interaction for menus or app navigation. Please make sure that all menus and app navigation are fully functional using a DPad. Please refer to our DPAD Control and Hardware Declaration documentation.
2020-08-17 23:20:55.092 3716-3716/com.vodu.smarttv E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.vodu.smarttv, PID: 3716
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vodu.smarttv/ahmed.jassim.vodutv.ui.search.SearchActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #27: Binary XML file line #27: Error inflating class androidx.leanback.widget.SearchBar
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #27: Binary XML file line #27: Error inflating class androidx.leanback.widget.SearchBar
Caused by: android.view.InflateException: Binary XML file line #27: Binary XML file line #27: Error inflating class androidx.leanback.widget.SearchBar
Caused by: android.view.InflateException: Binary XML file line #27: Error inflating class androidx.leanback.widget.SearchBar
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.app.SearchSupportFragment.onCreateView(SearchSupportFragment.java:294)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManagerImpl.java:1138)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:851)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1133)
at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1393)
at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3205)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:134)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:357)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:336)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420)
at android.app.Activity.setContentView(Activity.java:2771)
at ahmed.jassim.vodutv.ui.search.SearchActivity.onCreate(SearchActivity.java:15)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
2020-08-17 23:20:55.094 3716-3716/com.vodu.smarttv E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class androidx.leanback.widget.SpeechOrbView
Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class androidx.leanback.widget.SpeechOrbView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.widget.SearchBar.(SearchBar.java:165)
at androidx.leanback.widget.SearchBar.(SearchBar.java:155)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.app.SearchSupportFragment.onCreateView(SearchSupportFragment.java:294)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManagerImpl.java:1138)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:851)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1133)
at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1393)
at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3205)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:134)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:357)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:336)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420)
at android.app.Activity.setContentView(Activity.java:2771)
at ahmed.jassim.vodutv.ui.search.SearchActivity.onCreate(SearchActivity.java:15)
2020-08-17 23:20:55.094 3716-3716/com.vodu.smarttv E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.widget.SearchOrbView.(SearchOrbView.java:170)
at androidx.leanback.widget.SpeechOrbView.(SpeechOrbView.java:30)
at androidx.leanback.widget.SpeechOrbView.(SpeechOrbView.java:26)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.widget.SearchBar.(SearchBar.java:165)
at androidx.leanback.widget.SearchBar.(SearchBar.java:155)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.app.SearchSupportFragment.onCreateView(SearchSupportFragment.java:294)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManagerImpl.java:1138)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:851)
2020-08-17 23:20:55.095 3716-3716/com.vodu.smarttv E/AndroidRuntime: at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1133)
at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1393)
at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3205)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:134)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:357)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:336)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420)
at android.app.Activity.setContentView(Activity.java:2771)
at ahmed.jassim.vodutv.ui.search.SearchActivity.onCreate(SearchActivity.java:15)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.content.res.Resources$NotFoundException: Drawable (missing name) with resource ID #0x7f0700ae
Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0700ae
at android.content.res.ResourcesImpl.getResourceName(ResourcesImpl.java:255)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:785)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:631)
at android.content.res.Resources.loadDrawable(Resources.java:897)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:955)
at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
at android.widget.ImageView.(ImageView.java:189)
at android.widget.ImageView.(ImageView.java:172)
at android.widget.ImageView.(ImageView.java:168)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.widget.SearchOrbView.(SearchOrbView.java:170)
at androidx.leanback.widget.SpeechOrbView.(SpeechOrbView.java:30)
at androidx.leanback.widget.SpeechOrbView.(SpeechOrbView.java:26)
at java.lang.reflect.Constructor.newInstance0(Native Method)
2020-08-17 23:20:55.095 3716-3716/com.vodu.smarttv E/AndroidRuntime: at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.widget.SearchBar.(SearchBar.java:165)
at androidx.leanback.widget.SearchBar.(SearchBar.java:155)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.app.SearchSupportFragment.onCreateView(SearchSupportFragment.java:294)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManagerImpl.java:1138)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:851)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1133)
at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1393)
at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3205)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:134)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:357)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:336)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420)
at android.app.Activity.setContentView(Activity.java:2771)
at ahmed.jassim.vodutv.ui.search.SearchActivity.onCreate(SearchActivity.java:15)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2020-08-17 23:20:55.108 3716-3716/com.vodu.smarttv I/Process: Sending signal. PID: 3716 SIG: 9
Will you create example with BrowseSupportFragment? I tried to migrate myself but did not make it work. Neither menu nor Rows are shown.
For reference the logs of the crash are as follows:
2020-04-10 11:24:00.174 8649-8649/com.example.android.tvleanback E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.tvleanback, PID: 8649
java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.example.android.tvleanback.model.Video.title' on a null object reference
at com.example.android.tvleanback.ui.PlaybackFragment.play(PlaybackFragment.java:174)
at com.example.android.tvleanback.ui.PlaybackFragment.access$400(PlaybackFragment.java:72)
at com.example.android.tvleanback.ui.PlaybackFragment$PlaylistActionListener.onPrevious(PlaybackFragment.java:345)
at com.example.android.tvleanback.player.VideoPlayerGlue.previous(VideoPlayerGlue.java:165)
at androidx.leanback.media.PlaybackTransportControlGlue.dispatchAction(PlaybackTransportControlGlue.java:263)
at androidx.leanback.media.PlaybackTransportControlGlue.onActionClicked(PlaybackTransportControlGlue.java:194)
at com.example.android.tvleanback.player.VideoPlayerGlue.onActionClicked(VideoPlayerGlue.java:119)
at androidx.leanback.app.PlaybackSupportFragmentGlueHost$1.onItemClicked(PlaybackSupportFragmentGlueHost.java:64)
at androidx.leanback.app.PlaybackSupportFragmentGlueHost$1.onItemClicked(PlaybackSupportFragmentGlueHost.java:59)
at androidx.leanback.app.PlaybackSupportFragment$1.onItemClicked(PlaybackSupportFragment.java:159)
at androidx.leanback.widget.PlaybackTransportRowPresenter$2.onControlClicked(PlaybackTransportRowPresenter.java:573)
at androidx.leanback.widget.ControlBarPresenter$ViewHolder$3.onClick(ControlBarPresenter.java:164)
at android.view.View.performClick(View.java:5609)
at android.view.View.onKeyUp(View.java:10580)
at android.view.KeyEvent.dispatch(KeyEvent.java:2699)
at android.view.View.dispatchKeyEvent(View.java:9879)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at androidx.leanback.widget.PlaybackTransportRowView.dispatchKeyEvent(PlaybackTransportRowView.java:71)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at androidx.leanback.widget.BaseGridView.dispatchKeyEvent(BaseGridView.java:1015)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1667)
at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:403)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1800)
at androidx.core.view.KeyEventDispatcher.activitySuperDispatchKeyEventPre28(KeyEventDispatcher.java:130)
at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:87)
at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:133)
at com.example.android.tvleanback.ui.LeanbackActivity.dispatchKeyEvent(LeanbackActivity.java:76)
at com.example.android.tvleanback.ui.PlaybackActivity.dispatchKeyEvent(PlaybackActivity.java:89)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:317)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4327)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4298)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3849)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3902)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3868)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3995)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3876)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4052)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3849)
2020-04-10 11:24:00.174 8649-8649/com.example.android.tvleanback E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3902)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3868)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3876)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3849)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3902)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3868)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4028)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4189)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2365)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1961)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1952)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2342)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
I want to add more components apart form player view, playback control and related videos that is shown in the demo.
For example I want to add ImageView on top right corner of the screen, how do I customise the seekbar UI.
/.../AndroidTV/tv-samples/LeanbackShowcase/app/build/generated/ap_generated_sources/debug/out/androidx/leanback/leanbackshowcase/app/room/di/androidinject/LiveDataDetailViewWithVideoBackgroundFragmentModule_ContributeLiveDataDetailViewWithVideoBackgroundFragment.java:26: error: incompatible types: Class cannot be converted to Class<? extends Fragment>
@FragmentKey(LiveDataDetailViewWithVideoBackgroundFragment.class)
^
/.../AndroidTV/tv-samples/LeanbackShowcase/app/build/generated/ap_generated_sources/debug/out/androidx/leanback/leanbackshowcase/app/room/di/androidinject/SearchFragmentInjectorInstallmentFactoryBindingModule_ContributeSearchFragment.java:24: error: incompatible types: Class cannot be converted to Class<? extends Fragment>
@FragmentKey(SearchFragment.class)
^
/.../AndroidTV/tv-samples/LeanbackShowcase/app/build/generated/ap_generated_sources/debug/out/androidx/leanback/leanbackshowcase/app/room/di/androidinject/LiveDataFragmentModule_ContributeLiveDataFragment.java:23: error: incompatible types: Class cannot be converted to Class<? extends Fragment>
@FragmentKey(LiveDataFragment.class)
^
/.../AndroidTV/tv-samples/LeanbackShowcase/app/src/main/java/androidx/leanback/leanbackshowcase/app/room/di/androidinject/AppComponent.java:34: error: [ComponentProcessor:MiscError] dagger.internal.codegen.ComponentProcessor was unable to process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
public interface AppComponent {
I am playing a 720x480 video that is supposed to be shown at 16x9. It is showing vertically compressed as if it used square pixels. I added a VideoListener with onVideoSizeChanged method. That method is called with the correct values of 720 480 1.1851852. A strange thing is that if I set a breakpoint in that method, when it hits the breakpoint during start of play, the video is showing and playing at the correct shape, but as soon as that method is allowed to continue, the video shifts to the wrong size.
**When I try to implement the VideoConsumptionExampleWithExoPlayerFragment fragment in my application I get the following error while I try to play a video **
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.live.stream.iq_playtv, PID: 8553
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.live.stream.iq_playtv/com.live.stream.iq_playtv.leanback.LeanbackExoPlayerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()' on a null object reference
at androidx.leanback.widget.PlaybackControlsRow$ClosedCaptioningAction.(PlaybackControlsRow.java:726)
at androidx.leanback.widget.PlaybackControlsRow$ClosedCaptioningAction.(PlaybackControlsRow.java:711)
at com.live.stream.iq_playtv.leanback.VideoMediaPlayerGlue.(VideoMediaPlayerGlue.java:44)
at com.live.stream.iq_playtv.leanback.LeanbackExoPlayerFragment.onCreate(LeanbackExoPlayerFragment.java:78)
at android.app.Fragment.performCreate(Fragment.java:2503)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1256)
at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2426)
at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2205)
at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2161)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2062)
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3051)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2998)
at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:182)
at android.app.Activity.performCreate(Activity.java:7143)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
**And If I remove this bit of line and implementation
private PlaybackControlsRow.ClosedCaptioningAction mClosedCaptioningAction;
I get the following error :**
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.live.stream.iq_playtv, PID: 8685
android.view.InflateException: Binary XML file line #33: Binary XML file line #33: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #33: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.leanback.widget.PlaybackTransportRowPresenter.createRowViewHolder(PlaybackTransportRowPresenter.java:684)
at androidx.leanback.widget.RowPresenter.onCreateViewHolder(RowPresenter.java:326)
at androidx.leanback.widget.ItemBridgeAdapter.onCreateViewHolder(ItemBridgeAdapter.java:352)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at androidx.leanback.widget.GridLayoutManager.getViewForPosition(GridLayoutManager.java:1085)
at androidx.leanback.widget.GridLayoutManager$2.createItem(GridLayoutManager.java:1613)
at androidx.leanback.widget.SingleRow.appendVisibleItems(SingleRow.java:113)
at androidx.leanback.widget.Grid.appendOneColumnVisibleItems(Grid.java:389)
at androidx.leanback.widget.GridLayoutManager.appendOneColumnVisibleItems(GridLayoutManager.java:1839)
at androidx.leanback.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:2276)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4194)
at android.view.View.layout(View.java:20672)
at android.view.ViewGroup.layout(ViewGroup.java:6194)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:20672)
at android.view.ViewGroup.layout(ViewGroup.java:6194)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:20672)
at android.view.ViewGroup.layout(ViewGroup.java:6194)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083)
at android.view.View.layout(View.java:20672)
at android.view.ViewGroup.layout(ViewGroup.java:6194)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:20672)
at android.view.ViewGroup.layout(ViewGroup.java:6194)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
at android.view.View.layout(View.java:20672)
E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:6194)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:753)
at android.view.View.layout(View.java:20672)
at android.view.ViewGroup.layout(ViewGroup.java:6194)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2792)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2319)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
at android.view.Choreographer.doCallbacks(Choreographer.java:761)
at android.view.Choreographer.doFrame(Choreographer.java:696)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 68: TypedValue{t=0x2/d=0x7f040052 a=-1}
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:731)
at android.view.View.(View.java:5046)
at android.view.ViewGroup.(ViewGroup.java:659)
at android.widget.LinearLayout.(LinearLayout.java:244)
at android.widget.LinearLayout.(LinearLayout.java:240)
at android.widget.LinearLayout.(LinearLayout.java:236)
... 71 more
Please advise.
Thanks in advance.
In TvLauncherReceiver::onReceive()
the WorkManager is triggered to tell the channel and alls its programs to the "home screen"..
According to documentation the onReceive is triggered after installation. I've set some logs output:
I would like to make an app, which also can display these channels, like the home screen. Would that be possible? I would need the result of that WorkManager, made visible to another app!?
Reference:
App launched with setHeaderState(HEADERS_HIDDEN)
should hide the header and still display the rows.
On app launched, it is not displaying any items in the MainFragment.java
.
Pressing anything else on the D-pad (e.g. Press down), it will crash the app with the logs below:
2020-01-10 18:23:40.662 32294-32294/com.example.android.tvleanback E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.tvleanback, PID: 32294
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View androidx.fragment.app.Fragment.getView()' on a null object reference
at androidx.leanback.app.BrowseSupportFragment$4.onFocusSearch(BrowseSupportFragment.java:1096)
at androidx.leanback.widget.BrowseFrameLayout.focusSearch(BrowseFrameLayout.java:118)
at android.view.ViewGroup.focusSearch(ViewGroup.java:967)
at android.view.View.focusSearch(View.java:10171)
at android.view.ViewRootImpl$ViewPostImeInputStage.performFocusNavigation(ViewRootImpl.java:4664)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4782)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4605)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4293)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4350)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4326)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4487)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2435)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1998)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1989)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2412)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Pressing left D-pad will open the Header and start to display the items.
Change setHeadersState(HEADERS_ENABLED);
to setHeadersState(HEADERS_HIDDEN);
private void setupUIElements() {
setBadgeDrawable(
getActivity().getResources().getDrawable(R.drawable.videos_by_google_banner, null));
setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title
- setHeadersState(HEADERS_ENABLED);
+ setHeadersState(HEADERS_HIDDEN);
setHeadersTransitionOnBackEnabled(true);
We would like to launch the App without the header.
Build
androidx.leanback:leanback:1.0.0
Running on
Is there a way to have multiple entrypoints for the Global Search intent? I have an activity specific for handle search just like in the documentation, regardless of the path pattern in the searched content.
I would like to have activities able to handle search according to the path pattern in the data of the search intent, just like i do with Channels for example.
Here is an example of what I mean:
<activity android:name=".videos.EpisodeActivity">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<data
android:host="*"
android:pathPattern=".*/episode/.*"
android:scheme="${app_scheme}" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity android:name=".movies.MovieActivity">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<data
android:host="*"
android:pathPattern=".*/movie/.*"
android:scheme="${app_scheme}" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
However, if i specify a <data>
inside of the intent-filter like described above, the global search just stops working.
Is there a way to do this?
Hi All,
I am getting below crash randomly when we render the leanback fragment
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView$State.isPreLayout()' on a null object reference
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.leanback.widget.GridLayoutManager$2.addItem(GridLayoutManager.java:1704)
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.leanback.widget.SingleRow.prependVisibleItems(SingleRow.java:93)
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.leanback.widget.Grid.prependVisibleItems(Grid.java:371)
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.leanback.widget.GridLayoutManager.prependVisibleItems(GridLayoutManager.java:1940)
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.leanback.widget.GridLayoutManager.scrollDirectionPrimary(GridLayoutManager.java:2455)
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.leanback.widget.GridLayoutManager.scrollVerticallyBy(GridLayoutManager.java:2406)
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1972)
08-11 18:11:23.668 E/AndroidRuntime(16942): at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5476)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:781)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.view.Choreographer.doCallbacks(Choreographer.java:592)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.view.Choreographer.doFrame(Choreographer.java:559)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:767)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.os.Handler.handleCallback(Handler.java:739)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.os.Handler.dispatchMessage(Handler.java:95)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.os.Looper.loop(Looper.java:135)
08-11 18:11:23.668 E/AndroidRuntime(16942): at android.app.ActivityThread.main(ActivityThread.java:5604)
08-11 18:11:23.668 E/AndroidRuntime(16942): at java.lang.reflect.Method.invoke(Native Method)
08-11 18:11:23.668 E/AndroidRuntime(16942): at java.lang.reflect.Method.invoke(Method.java:372)
08-11 18:11:23.668 E/AndroidRuntime(16942): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
08-11 18:11:23.668 E/AndroidRuntime(16942): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
How to fix this
The sample application leanback-showcase crashes at launch upon selecting MusicConsumptionExampleFragment
2020-05-03 22:37:20.440 3547-3547/com.google.android.tvlauncher E/PrtnrWidgetInfoLdr: Exception in onStartLoading() on registering content observer
java.lang.SecurityException: Failed to find provider tvlauncher.widget for user 0; expected to find a valid ContentProvider for this authority
at android.os.Parcel.readException(Parcel.java:2004)
at android.os.Parcel.readException(Parcel.java:1950)
at android.content.IContentService$Stub$Proxy.registerContentObserver(IContentService.java:768)
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1924)
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1913)
at com.google.android.tvlauncher.data.PartnerWidgetInfoLoader.onStartLoading(PartnerWidgetInfoLoader.java:66)
at android.content.Loader.startLoading(Loader.java:290)
at android.app.LoaderManagerImpl$LoaderInfo.start(LoaderManager.java:283)
at android.app.LoaderManagerImpl.doStart(LoaderManager.java:783)
at android.app.Fragment.onStart(Fragment.java:1631)
at com.google.android.tvlauncher.home.HomeFragment.onStart(HomeFragment.java:239)
at android.app.Fragment.performStart(Fragment.java:2534)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1315)
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1618)
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3027)
at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:2984)
at android.app.FragmentController.dispatchStart(FragmentController.java:189)
at android.app.Activity.performStart(Activity.java:7035)
at android.app.Activity.performRestart(Activity.java:7104)
at android.app.Activity.performResume(Activity.java:7109)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1638)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
2020-05-03 22:37:20.441 3547-918/com.google.android.tvlauncher E/ActivityThread: Failed to find provider info for tvlauncher.widget
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.