Android Open Source - adr Main Activity






From Project

Back to project page adr.

License

The source code is released under:

Copyright (c) 2014, blake kim All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Re...

If you think the Android project adr listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kkh.telconetworktest;
//w  w w .j  a v  a  2s . c  o m
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.TextView;

public class MainActivity extends Activity {
  static final String tag = "TelcoNet";
  TextView mtvPhone, mtvTelco, mtvIccid;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Log.e(tag, "OnCre...");
    
    mtvPhone = (TextView)findViewById(R.id.tvPhoneNumber);
    mtvTelco = (TextView)findViewById(R.id.tvTelco);
    mtvIccid = (TextView)findViewById(R.id.tvIccid);
    
    TelephonyManager manager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    String carrierName = manager.getNetworkOperatorName();
    mtvTelco.setText("telco name: " + carrierName);
    
    String number = manager.getLine1Number(); // READ_PHONE_STATE ????? ??.
    mtvPhone.setText("phone: " + number);
    
    String iccid = manager.getSimSerialNumber();
    mtvIccid.setText("iccid: " + iccid);
    
    
  }
}




Java Source Code List

com.kkh.httptest.MainActivity.java
com.kkh.imagetest.MainActivity.java
com.kkh.telconetworktest.MainActivity.java