package com.lrosier.encryptdecrypt; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.*; import android.widget.*; public class EncryptDecryptActivity extends ActionBarActivity { // instance variables go here EditText encryptedEditText; EditText decryptedEditText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_encrypt_decrypt); encryptedEditText = (EditText) findViewById(R.id.encryptedittext); decryptedEditText = (EditText) findViewById(R.id.decryptedittext); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.encrypt_decrypt, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void buttonEncryptClick(View view) { // handle encryption the data // encryptedittext String data = encryptedEditText.getText().toString(); data = encrypt(data); decryptedEditText.setText(data); } public void buttonDecryptClick(View view) { // handle decryption the data // decryptedittext String data = decryptedEditText.getText().toString(); data = decrypt(data); encryptedEditText.setText(data); } public String encrypt(String message) { String encrypted = ""; for (int i=0; i> x; decrypted += (char) ch; } return decrypted; } }