Thursday, June 14, 2018

လဵပ်ႈႁဵၼ်း Android Studio 001 ( Toast Message + Click Button)

လဵပ်ႈႁဵၼ်း Android Studio 001 ( Toast Message + Click Button)



main.xml code

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".Main">


    <Button        android:id="@+id/btn"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_weight="1"        android:text="Click" />
</LinearLayout>

Main java code

package com.example.jaotainum.toast;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class Main extends AppCompatActivity {
    Button test;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        test= (Button) findViewById(R.id.btn);
        test.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {
                Toast.makeText(Main.this, "Hello", Toast.LENGTH_SHORT).show();
            }
        });

    }

    public void dosomthing(View v) {

    }
}

No comments:

Post a Comment

လွၵ်းမိုဝ်း လႄႈ ၽွၼ်ႉ တႃႇၶွမ်း Windows (Keyboard and Fonts For Windows 7,8,10)

ၼင်ႇႁိုဝ်လႄႈ ပေႃးတေပဵၼ်တၢင်းၵမ်ႉထႅမ် တွၼ်ႈတႃႇၽူႈၸႂ်ႉတိုဝ်းၶွမ်းႁဝ်းၶဝ်ၼၼ်ႉ လူဝ်ႇမႃးမိူဝ်ႈလႂ်ၵေႃႈ ႁႂ်ႈပေႃးႁႃငၢႆႈ ၸၼ်ငၢႆႈ ယိူင်းဢၢၼ်း...