/* * Copyright (C) 2011 Patrik �kerfeldt * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.taptwo.android.widget.viewflow.example; import org.taptwo.android.widget.TitleFlowIndicator; import org.taptwo.android.widget.ViewFlow; import android.app.Activity; import android.content.res.Configuration; import android.os.Bundle; public class TitleViewFlowExample extends Activity { private ViewFlow viewFlow; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.title_title); setContentView(R.layout.title_layout); viewFlow = (ViewFlow) findViewById(R.id.viewflow); AndroidVersionAdapter adapter = new AndroidVersionAdapter(this); viewFlow.setAdapter(adapter, 3); TitleFlowIndicator indicator = (TitleFlowIndicator) findViewById(R.id.viewflowindic); indicator.setTitleProvider(adapter); viewFlow.setFlowIndicator(indicator); } /* If your min SDK version is < 8 you need to trigger the onConfigurationChanged in ViewFlow manually, like this */ @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); viewFlow.onConfigurationChanged(newConfig); } }