나는 상자에 당신의 이름을 쓰고 ok를 클릭하면 새 페이지가 당신의 이름을 보여줄 것입니다. 문제는 ok를 클릭해도 아무 일도 일어나지 않는다는 것입니다. 여기 매니페스트안드로이드에서 두 가지 활동 연결하기
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.calpoly.android.lab1Sada"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="4" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Click"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="HelloWorld" ></activity>
</application>
</manifest>
public class Click extends Activity implements OnClickListener{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String TypedText = (String)MyText.getText().toString();
Intent MyInt = new Intent(this, HelloWorld.class);
MyInt.putExtra("user", TypedText);
this.startActivity(MyInt);
Bundle Retrive = this.getIntent().getExtras();
Retrive.getString("user");
setContentView(R.id.Text);
TextView TextV = (TextView)findViewById(R.id.Text);
TextV.setText("user");
}
android.widget.EditText MyText;
public void OnCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
this.setContentView(R.layout.name_getter);
MyText = (EditText)this.findViewById(R.id.editText1);
this.findViewById(R.id.button1);
android.widget.Button RefBut = (Button)this.findViewById(R.id.button1);
RefBut.setOnClickListener(this);
}
다음은 주요 활동
그리고 첫 번째 활동 클릭을 시작합니다하지만 앱이 새로운보기를 표시하지 않는 안드로이드 에뮬레이터를 시작 ...
HelloWorld 활동을위한 코드? –
당신은 단지 안드로이드의 "의도"개념을 이해해야합니다. –
@RahulChoudhary Eclipse에서 새로운 Android 프로젝트를 시작하는 간단한 Helloworld 클래스입니다. –