import android.widget.Toast;
import android.view.*;
import android.widget.*;
Button clearBtn = new Button(ctx);
clearBtn.setText("clear");
clearBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
me.mte.setText("");
}
});
lay.addView(clearBtn);
import android.view.*;
import android.widget.*;
import android.content.*;
Button shareBtn = new Button(ctx);
shareBtn.setText("share");
shareBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, me.mte.getText().toString());
sendIntent.setType("text/plain");
me.startActivity(sendIntent);
}
});
lay.addView(shareBtn);
import android.app.*;
/*
Notification.Builder mBuilder =
new Notification.Builder(ctx)
.setSmallIcon(android.R.drawable.ic_delete)
.setContentTitle("from galaxy")
.setContentText("Hello World!");
NotificationManager mNotifyMgr = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
mNotifyMgr.notify(101, mBuilder.build()); */
ngin.redirectOutputToFile(ctx.getFilesDir().toString() + "/output.txt");
示例扩展 (