1
package org.waxworlds.importcontacts;
3
import java.util.Stack;
5
import android.app.Activity;
6
import android.content.Intent;
7
import android.os.Bundle;
9
public class ImportContacts extends Activity
11
public static final int STATE_NONE = 0;
12
public static final int STATE_IMPORT_VCF = 1;
13
public static final int STATE_MERGE = 2;
14
public static final int STATE_DOIT = 3;
16
private Stack< Integer > _stateStack;
18
/** Called when the activity is first created. */
20
public void onCreate(Bundle savedInstanceState)
22
super.onCreate(savedInstanceState);
24
_stateStack = new Stack< Integer >();
26
startState( STATE_IMPORT_VCF );
30
protected void onActivityResult(int requestCode, int resultCode, Intent data)
32
super.onActivityResult(requestCode, resultCode, data);
35
if( resultCode == RESULT_CANCELED ) {
39
int newState = STATE_NONE;
41
Bundle extras = data.getExtras();
42
if( extras != null ) {
43
Integer tmp = extras.getInt( "nextstate" );
45
newState = tmp.intValue();
49
startState( newState );
53
private void startState( int newState )
55
if( newState == STATE_NONE )
57
// we're going back, so pop top state off stack
59
newState = ( (Integer)_stateStack.peek() ).intValue();
63
// push new state on state
64
_stateStack.push( new Integer( newState ) );
67
// figure out the class
70
case STATE_IMPORT_VCF: cls = ImportVCF.class; break;
71
case STATE_MERGE: cls = Merge.class; break;
72
case STATE_DOIT: cls = Doit.class; break;
76
Intent i = new Intent( this, cls );
77
if( _stateStack.size() > 1 ) i.putExtra( "backstate", true );
78
startActivityForResult( i, 0 );
b'\\ No newline at end of file'