package ca.ualberta.cs.lonelytwitter;

import android.os.Bundle;
import android.widget.TextView;
import android.app.Activity;
import android.content.Intent;

public class IntentReaderActivity extends Activity {

	public static final String TEXT_TO_TRANSFORM_KEY = "TEXT";
	public static final String MODE_OF_TRANSFORM_KEY = "TRANSFORM";

	public static final int NORMAL = 1;
	public static final int REVERSE = 2;
	public static final int DOUBLE = 3;
	
	private String text;
	private int mode;
	
	public String getText() {
		return text;
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_intent_reader);
		
        Intent intent = getIntent();
        mode = intent.getIntExtra(MODE_OF_TRANSFORM_KEY, NORMAL); 
//        mode = ((intent.getExtras()==null) ? NORMAL : intent.getExtras().getInt(MODE_OF_TRANSFORM_KEY));
        
        if (intent.getStringExtra(TEXT_TO_TRANSFORM_KEY) != null) 
        	text = transformText(intent.getStringExtra(TEXT_TO_TRANSFORM_KEY));
        else 
        	text = "default text";
        
        ((TextView)findViewById(R.id.intentText)).setText(text);
	}

	public String transformText(String str) {
		switch (mode) {
			case REVERSE:
				char[] str2 =  str.toCharArray();
				for (int i = 0; i < str2.length / 2; i++) {
					char tmp = str2[i];
					str2[i] = str2[str2.length - i -1];
					str2[str2.length - i - 1] = tmp;
				}//for.
				return new String(str2);
			case DOUBLE:
				return str + str;
			default: 
				return str;
		}
	}
}

@@ -696,491 +696,38 @@
 %0A%09%09%0A
-        Intent intent = getIntent();%0A        mode = intent.getIntExtra(MODE_OF_TRANSFORM_KEY, NORMAL); %0A//        mode = ((intent.getExtras()==null) ? NORMAL : intent.getExtras().getInt(MODE_OF_TRANSFORM_KEY));%0A        %0A        if (intent.getStringExtra(TEXT_TO_TRANSFORM_KEY) != null) %0A        %09text = transformText(intent.getStringExtra(TEXT_TO_TRANSFORM_KEY));%0A        else %0A        %09text = %22default text%22;%0A        %0A        ((TextView)findViewById(R.id.intentText)).setText(text);
+%09%09//TODO: Add your code here:%0A
 %0A%09%7D%0A

Update IntentReaderActivity.java