android外部类调用mainactivity

时间:2016-01-26 05:09:21

标签: android

清单

    <activity android:name=".util.SSIDCheck">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>  <receiver android:name=".util.SSIDChangeReceiver"
        android:enabled="true">
<intent-filter>
    <action android:name="intent.action.TEST"></action>
    <action android:name="android.intent.action.BOOT_COMPLETED"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

    </receiver>

mainActivity

enter code here// setContentView(R.layout.activity_blackeye_main);
    SSIDCheck ssidCheck = new SSIDCheck();
    ssidCheck.onCreate(savedInstanceState);

我想要显示SSIDCheck 我该怎么办?

mainActivity是什么命令代码?

1 个答案:

答案 0 :(得分:0)

在清单文件中

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    SSIDCheck ssidCheck = new SSIDCheck();`write your code here`
}

在mainActivity类

var txt = document.getElementById("phone");
txt.onkeypress = function(key) {
  if (key.charCode < 48 || key.charCode > 57) return false;
}
txt.addEventListener("paste",
  function(e) {
    e.preventDefault();
    var pastedData = e.clipboardData.getData('Text');
    if (!isNaN(pastedData)) {
      txt.value += pastedData;
    }
  }, true);