Muhammad Adil
Muhammad Adil

Reputation: 4668

how to do Implementation of Android TvView

I have started working on Android Smart Tv. I have to make a TvView, I Know Leanback is only library which gives us a lot of stuff to work with Android Smart Tv. Last day i have tried to work with TvView to perform streaming of channels. I have included android-support-Leanback17 . but still i am getting error That no class definition found. Any Help will be appreciated . i Just want to know that which library support this TvView. Thanks in Advance

This is my LogCat

  11-27 09:25:10.684: E/AndroidRuntime(16203): FATAL EXCEPTION: main
  11-27 09:25:10.684: E/AndroidRuntime(16203): java.lang.NoClassDefFoundError:    android.media.tv.TvView
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at    com.example.tvtest.MainActivity.onCreate(MainActivity.java:25)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.app.Activity.performCreate(Activity.java:5104)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.os.Handler.dispatchMessage(Handler.java:99)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.os.Looper.loop(Looper.java:137)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at android.app.ActivityThread.main(ActivityThread.java:5041)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at java.lang.reflect.Method.invokeNative(Native Method)
   11-27 09:25:10.684: E/AndroidRuntime(16203):     at java.lang.reflect.Method.invoke(Method.java:511)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
  11-27 09:25:10.684: E/AndroidRuntime(16203):  at dalvik.system.NativeStart.main(Native Method)

Upvotes: 2

Views: 3435

Answers (3)

yadunath.narayanan
yadunath.narayanan

Reputation: 285

It is possible to add TVVIEw component to your application like this

> <android.media.tv.TvView
>             android:id="@+id/dtv_view"
>             android:layout_width="match_parent"
>             android:layout_height="match_parent"
>             android:visibility="visible" />

And it is possible to tune to particular channgel using below code

String channelUrl="content://android.media.tv/channel/"+channelNumber;
mTvView.tune(mInputId, Uri.parse(channelUrl));

input id is available in TV database(refering to which source channel is coming from).

If you pass these info to tvview it will start playing.

Upvotes: 0

Min2
Min2

Reputation: 10971

I would suggest everyone to go for this Google sample or implementation for Android TvView:

https://android.googlesource.com/platform/packages/apps/TV/

Upvotes: 0

PRIZ3
PRIZ3

Reputation: 116

I'm assuming you want to allow users to watch content and if so, you will not actually implement a TVView. Google provides the 'Live Channels' app which will display channels provided via the TVInputFramework. This app is hidden until an app implementing the TVInputFramework is installed.

Google has now released a sample app implementing the TVInputFramework which will publish channels that can be watched in the Live Channels app.

Documentation outlining the TVInputFramework: http://developer.android.com/training/tv/tif/index.html

I hope this will at least point you in the right direction even if it doesn't directly answer your question.

Upvotes: 4

Related Questions