Friday, January 16, 2015

Balance Check Apk(Button Click)


အ​ေပၚမွာ ​ေျပာထားတဲ့အတိုင္​း AIDE Apk စတင္​ဖြင္​့ပါ။ၿပီးရင္​ res>>>>layout>>>>main.xmlကိုဖြင္​့ပါ။
​ေအာက္​က code ကို ထည္​့ပါ။

<Button
android:id="@+id/buttonCall"
android:layout_height="wrap_content"
style="?android:attr/buttonBarButtonStyle"
android:text="ေဘစစ္ရန္"
android:layout_width="wrap_content"/>



src >>> MainActivity.java ကိုဖြင္​့ပါ။ ​ေအာက္​က code ကို ထည္​့ပါ။

import(အပိုင္​း)
import android.content.Context;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

final Context context = this;
private Button button;

Source(အပိုင္​း)

button = (Button) findViewById(R.id.buttonCall);
// add button listener
button.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
startActivity(new Intent("android.intent.action.CALL",Uri.parse("tel:*124" + Uri.encode("#"))));}});

AndroidManifest.xml(အပိုင္​း)

<uses-permission android:name="android.permission.CALL_PHONE" />
   <uses-permission android:name="android.perပmission.READ_PHONE_STATE" />
 




မွတ္​ခ်က္​=(124 ​ေနရာမွာ သင္​ဖုန္​းလိုင္​းကဒ္​ အ​ေပၚမူတည္​ၿပီး ​ေျပာင္​းလဲႏိုင္​ပါသည္​။)


အဆင္​​ေျပပါ​ေစ။


​ေရးသားသူ =​ေဇယ်ာလင္​း

No comments:

Post a Comment