<relativelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Xmlns:tools= "Http://schemas.android.com/tools"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
android:paddingbottom= "@dimen/activity_vertical_margin"
android:paddingleft= "@dimen/activity_horizontal_margin"
android:paddingright= "@dimen/activity_horizontal_margin"
android:paddingtop= "@dimen/activity_vertical_margin"
tools:context= "Com.example.test1.MainActivity" >
<textview
Android:id= "@+id/textview1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "@string/hello_world"/>
<textview
Android:id= "@+id/textview2"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_alignleft= "@+id/edittext1"
Android:layout_alignparentleft= "true"
Android:layout_alignparentright= "true"
android:layout_alignright= "@+id/button1"
android:layout_below= "@+id/textview1"
android:layout_margintop= "59DP"
android:text= "read-only text"
Android:textsize= "15pt"
Android:textcolor= "#0092c7"/>
<edittext
Android:id= "@+id/edittext1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_above= "@+id/button1"
Android:layout_centerhorizontal= "true"
Android:layout_marginbottom= "55DP"
Android:ems= "10"
android:hint= "Display after delete is complete, prompt function"
android:text= "text box test" >
<requestfocus/>
</EditText>
<button
Android:id= "@+id/button1"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_below= "@+id/textview2"
Android:layout_centerhorizontal= "true"
android:layout_margintop= "85DP"
Android:hint= "Determining function Hints"
android:text= "@string/btn1text"
android:textstyle= "Bold"/>
<button
Android:id= "@+id/button01"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_alignleft= "@+id/button1"
android:layout_below= "@+id/button1"
android:layout_margintop= "18DP"
Android:hint= "pop-up window function Tips"
android:text= "@string/btn2text"
android:textstyle= "Bold"/>
<button
Android:id= "@+id/button02"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_alignleft= "@+id/button1"
android:layout_alignright= "@+id/button01"
android:layout_below= "@+id/button01"
android:layout_margintop= "28DP"
android:hint= "drop-down window function Tip"
android:text= "@string/btn3text"
android:textstyle= "Bold"/>
</RelativeLayout>
///////////////////////////////////////////////////////////////////////////////////////////
Package com.example.test1;
Import android.support.v7.app.ActionBarActivity;
Import Android.os.Bundle;
Import Android.view.Menu;
Import Android.view.MenuItem;
Import Android.widget.EditText;
public class POPU_TC extends Actionbaractivity {
////////////////////
Private EditText Text_popu;
////////////////////
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.LAYOUT.ACTIVITY_POPU__TC);
1///////////
Text_popu = (EditText) Findviewbyid (R.ID.EDITTEXT_POPU);
////////////////////
2///////////
Bundle Bunde = This.getintent (). Getextras ();
String STRs = bunde.getstring ("Key3"). ToString ();
Text_popu.settext (bunde.getstring ("Key3"). toString ());
////////////////////
}
@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R.MENU.POPU__TC, menu);
return true;
}
@Override
public boolean onoptionsitemselected (MenuItem item) {
Handle Action Bar Item clicks here. The Action Bar would
Automatically handle clicks on the Home/up button, so long
As you specify a the parent activity in Androidmanifest.xml.
int id = item.getitemid ();
if (id = = r.id.action_settings) {
return true;
}
return super.onoptionsitemselected (item);
}
}
///////////////////////////////////////////////////////////////////////////////////////////
Package com.example.test1;
Import android.support.v7.app.ActionBarActivity;
Import Android.os.Bundle;
Import Android.view.Menu;
Import Android.view.MenuItem;
////////////////////
Import Android.view.View;
Import Android.widget.Button;
Import Android.widget.EditText;
Import Android.widget.Toast;
Import android.content.Intent;
////////////////////
public class Mainactivity extends Actionbaractivity {
////////////////////
Private Button MyButton;
Private EditText MyText;
Private Button MyButton01;
Private Button myButton02;
////////////////////
@Override
protected void onCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
//////////1///////
MyButton = (Button) Findviewbyid (R.id.button1);
myText = (EditText) Findviewbyid (R.ID.EDITTEXT1);
Mybutton.setonclicklistener (New View.onclicklistener () {
@Override
public void OnClick (View v) {
TODO auto-generated Method Stub
Mytext.settext ("Get a sense of listening!");
}
});
////////////////////
2//////////
MyButton01 = (Button) Findviewbyid (R.ID.BUTTON01);
Mybutton01.setonclicklistener (New View.onclicklistener () {
@Override
public void OnClick (View v) {
TODO auto-generated Method Stub
Show text-------test passed
Mytext.settext ("Get a sense of listening 2!");
Intent responsible for program jump and pass data
Intent Intent = new Intent (this,f1_tc.class);
StartActivity (Intent);
Toast.maketext (This, "Toast", Toast.length_short). Show ();
Intent Intent = new Intent (mainactivity.this, F1_tc.class);
StartActivity (Intent);
Open a pseudo window-------test passes
Toast.maketext (Getapplicationcontext (), "Hint: Click outside the window to close the window!" ",
Toast.length_short). Show ();
}
});
////////////////////
3//////////
MYBUTTON02 = (Button) Findviewbyid (R.ID.BUTTON02);
Mybutton02.setonclicklistener (New View.onclicklistener () {
@Override
public void OnClick (View v) {
Intent responsible for program jump and pass data
Intent Intent = new Intent (mainactivity.this,popu_tc.class);
Bundle bundle = new bundle (); Data delivery via bundles:
Bundle.putstring ("Key1", "value1"); Key1 is the name, value1 is the value
Bundle.putstring ("Key2", mybutton02.tostring ());
Bundle.putstring ("Key3", Mytext.gettext (). toString ());
Bundle.putint ("KeyInt1", 100); Integer type
Intent.putextras (bundle); Data transfer
StartActivity (Intent); -------test pass//Do not need sub-window callback data
Startactivityforresult (Intent, 1); Requestcode is the ID flag of the child window and must be greater than 1, otherwise the callback function Onactivityresult not respond!
}
});
////////////////////
}
@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R.menu.main, menu);
return true;
}
@Override
public boolean onoptionsitemselected (MenuItem item) {
Handle Action Bar Item clicks here. The Action Bar would
Automatically handle clicks on the Home/up button, so long
As you specify a the parent activity in Androidmanifest.xml.
int id = item.getitemid ();
if (id = = r.id.action_settings) {
return true;
}
return super.onoptionsitemselected (item);
}
}
20150602_andriod passing parameters to a form