1
package org.waxworlds.importcontacts;
3
import android.app.Activity;
4
import android.content.Intent;
5
import android.content.SharedPreferences;
6
import android.os.Bundle;
7
import android.view.View;
8
import android.widget.Button;
10
public class WizardActivity extends Activity
12
private int _nextState = 0;
15
protected void onCreate(Bundle savedInstanceState)
17
super.onCreate(savedInstanceState);
20
Button next = (Button)findViewById( R.id.next );
21
next.setOnClickListener( new View.OnClickListener() {
22
public void onClick( View view ) {
23
switchToState( _nextState );
28
Button back = (Button)findViewById( R.id.back );
29
back.setOnClickListener( new View.OnClickListener() {
30
public void onClick( View view ) {
31
setResult( RESULT_OK );
36
// enable back button?
37
Bundle extras = getIntent().getExtras();
38
if( extras != null ) {
39
Boolean backstate = extras.getBoolean( "backstate" );
40
if( backstate != null )
41
( (Button)findViewById( R.id.back ) ).setEnabled( true );
45
protected void setNextState( int nextState )
47
// set next state and enable button
48
_nextState = nextState;
49
( (Button)findViewById( R.id.next ) ).setEnabled( true );
52
private void switchToState( int newState )
56
// create result data bundle
57
Bundle bundle = new Bundle();
58
bundle.putInt( "nextstate", newState );
60
// create response intent and finish
61
Intent i = new Intent();
62
i.putExtras( bundle );
63
setResult( RESULT_OK, i );
68
public SharedPreferences getSharedPreferences()
70
return super.getSharedPreferences( "ImportContacts", 0 );
b'\\ No newline at end of file'