package com.example;
import com.example.hyptest.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
public class TestActivity extends Activity {
void test() {
final LinearLayout layout = new LinearLayout(this);
// layout.setOrientation(LinearLayout.VERTICAL);
Button button = new Button(this);
button.setText("Click Me");
button.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
button.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// Starting Another Activity
Intent intent = new Intent(TestActivity.this , T2Activity.class);
//EditText editText = (EditText) findViewById(R.id.edit_message);
//String message = editText.getText().toString();
//intent.putExtra(EXTRA_MESSAGE, "abcc");
startActivity(intent);
}
});
layout.addView(button);
setContentView(layout);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
test();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_hyp_test, menu);
return true;
}
}