1247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell/* 2247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * Copyright (C) 2012 The Android Open Source Project 3247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * 4247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * you may not use this file except in compliance with the License. 6247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * You may obtain a copy of the License at 7247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * 8247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 9247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * 10247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * Unless required by applicable law or agreed to in writing, software 11247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * See the License for the specific language governing permissions and 14247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell * limitations under the License. 15247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell */ 16247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 17247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellpackage com.example.android.appnavigation.app; 18247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 19247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellimport com.example.android.appnavigation.R; 20247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 21247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellimport android.app.Activity; 22247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellimport android.content.Intent; 23247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellimport android.os.Bundle; 24247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellimport android.view.View; 25247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellimport android.widget.TextView; 26247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 27247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powellpublic class PeerActivity extends Activity { 28247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell private static final String EXTRA_PEER_COUNT = 29247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell "com.example.android.appnavigation.EXTRA_PEER_COUNT"; 30247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 31247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell private int mPeerCount; 32247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 33247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell @Override 34247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell protected void onCreate(Bundle savedInstanceState) { 35247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell super.onCreate(savedInstanceState); 36247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell setContentView(R.layout.peer); 37247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 38247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell mPeerCount = getIntent().getIntExtra(EXTRA_PEER_COUNT, 0) + 1; 39247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell TextView tv = (TextView) findViewById(R.id.peer_counter); 40247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell tv.setText(getResources().getText(R.string.peer_count).toString() + mPeerCount); 41247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell } 42247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell 43247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell public void onLaunchPeer(View v) { 44247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell Intent target = new Intent(this, PeerActivity.class); 45247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell target.putExtra(EXTRA_PEER_COUNT, mPeerCount); 46247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell startActivity(target); 47247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell } 48247df4fe798d63ab99fed6fd7c4de0fc913b3aecAdam Powell} 49