1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.example.android.musicbrowserdemo; 18 19 import android.support.v4.app.FragmentActivity; 20 import android.support.v4.app.FragmentManager; 21 22 import android.os.Bundle; 23 import android.util.Log; 24 import android.view.View; 25 import android.widget.ArrayAdapter; 26 import android.widget.ListView; 27 28 /** 29 * Main activity class. 30 */ 31 public class MainActivity extends FragmentActivity { 32 33 private static final String BROWSER_FRAGMENT_TAG = "browser"; 34 35 @Override 36 protected void onCreate(Bundle icicle) { 37 super.onCreate(icicle); 38 39 Log.d("MainActivity", "-------------------------------------------------------"); 40 41 // If we are starting afresh, start at the app list. 42 final FragmentManager fm = getSupportFragmentManager(); 43 if (fm.findFragmentById(android.R.id.content) == null) { 44 fm.beginTransaction().add(android.R.id.content, new AppListFragment()).commit(); 45 } 46 } 47 } 48 49