Following Activiti ( Android )

package Following.aerdy;

import android.app.Activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import bsh.

public class FollowingActivity extends Activity {
private Interpreter i=new Interpreter();

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn=(Button)findViewById(R.id.eval);
final EditText script=(EditText)findViewById(R.id.script);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
String src=script.getText().toString();
try {
i.set(“context”, FollowingActivity.this);
i.eval(src);
}
catch (bsh.EvalError e) {
AlertDialog.Builder builder=
new AlertDialog.Builder(MainActivity.this);
builder
.setTitle(“Exception!”)
.setMessage(e.toString())
.setPositiveButton(“OK”, null)
.show();
}
}
});
}

}

Download projectnya di Sini

Advertisements

Published by

jarcode

hello I am jarcode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s