Package com. eboy. checksimoperator;
Import Android. App. activity;
Import Android. content. context;
Import Android. OS. Bundle;
Import Android. telephony. telephonymanager;
Import Android. View. Menu;
Import Android. View. view;
Import Android. widget. Toast;
Public class mainactivity extends activity {
@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. activity_main );
}
@ Override
Public Boolean oncreateoptionsmenu (menu ){
Getmenuinflater (). Inflate (R. Menu. activity_main, menu );
Return true;
}
Public void checksim (view v ){
Telephonymanager telmanager = (telephonymanager) getsystemservice (context. telephony_service );
String operator = telmanager. getsimoperator ();
If (Operator! = NULL ){
If (operator. Equals ("46000") | Operator. Equals ("46002 ")){
Toast. maketext (this, "this card belongs to (China Mobile)", Toast. length_short). Show ();
} Else if (operator. Equals ("46001 ")){
Toast. maketext (this, "this card belongs to (China Unicom)", Toast. length_short). Show ();
} Else if (operator. Equals ("46003 ")){
Toast. maketext (this, "this card belongs to (China Telecom)", Toast. length_short). Show ();
}
}
}
}