အေပၚမွာ ေျပာထားတဲ့အတိုင္း AIDE Apk စတင္ဖြင့္ပါ။ၿပီးရင္ res>>>>layout>>>>main.xmlကိုဖြင့္ပါ။
ေအာက္က code ကို ထည့္ပါ။
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Click me to another screen" />
main2.xml ဆိုၿပီး ဖိုင္အသစ္ ဖြင့္ေပးရမယ္။
ေအာက္တြင္ ၾကည့္ရန္
TextView
android:layout_height="wrap_content"
android:text="AIDE"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"/>
Add new xml file here ကိုႏိွပ္ပါ။
src >>> MainActivity.java ကိုဖြင့္ပါ။ ေအာက္က code ကို ထည့္ပါ။
import(အပိုင္း)
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
Button button;
Source(အပုိင္း)
addListenerOnButton();
}
public void addListenerOnButton() {
final Context context = this;
button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(context, MainActivity2.class);
startActivity(intent); }});
MainActivity2.java ဖိုင္အသစ္ဖြင့္မည္။
ေအာက္တြင္ ၾကည့္ရန္
Add new Class here ကိုႏိွပ္ပါ။
MainActivity2.java တြင္ ေအာက္က Code ထည့္ရန္
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.os.Bundle;
import android.widget.Button;
public class MainActivity2 extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
}
}
AndroidManifest.xml(အပိုင္း)
<activity
android:label="@string/app_name"
android:name=".App2Activity" >
</activity>
အဆင္ေျပပါေစ။
ေရးသားသူ =ေဇယ်ာလင္း
ေရးသားသူ =ေဇယ်ာလင္း
No comments:
Post a Comment