Extract all tv channel in tv using tvinputmanager in android

Home Activity.java Plese helped me explain how it gets the list of all channels

public class MainActivity extends Activity {
    private static final String TAG = MainActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final Button button = (Button)findViewById(R.id.ping_button);
         Button access = (Button)findViewById(R.id.btnaccess);
         Button justtest=(Button)findViewById(R.id.btntest);
         button.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {

              System.out.print("Listing TvInputManager TvInputInfo list:\n");
        TvInputManager tvInputManager=(TvInputManager)getApplicationContext().getSystemService(TV_INPUT_SERVICE);
        List<TvInputInfo> tvInputList=tvInputManager.getTvInputList();
        Log.i("TV", "Got "+tvInputList.size()+ " TvInputsInfos.");
        for (int i=0; i<tvInputList.size(); i++) {
            Log.i("TV", tvInputList.get(i).getId());
        }

             }
         });

        Intent intent = new Intent();
        intent.setAction("com.futarque.StartTvService");
        sendBroadcast(intent);


        justtest.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                System.out.print("Listing TvInputManager TvInputInfo list:\n");
                TvInputManager tvInputManager=(TvInputManager)getApplicationContext().getSystemService(TV_INPUT_SERVICE);
                List<TvInputInfo> tvInputList=tvInputManager.getTvInputList();
                Log.i("TV", "Got "+tvInputList.size()+ " TvInputsInfos.");
                for (int i=0; i<tvInputList.size(); i++) {
                    Log.i("TV", tvInputList.get(i).getId());
                }

            }
        });
        Intent intent = new Intent();
        intent.setAction("com.futarque.StartTvService");
        sendBroadcast(intent);

      

+3
java android video-streaming tv


source to share


No one has answered this question yet

Check out similar questions:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to persist android activity state by persisting instance state?
2097
Is there a way to run Python on Android?
1844
What is "Context" on Android?
2
setText on a button from another kind of android activity
0
java.lang.NullPointerException when calling onLoadFinished ()
-2
The activity can still call the unbind method. This is normal?



All Articles
Loading...
X
Show
Funny
Dev
Pics