Smart config, Wifi 快连嵌入移动应用 (And

2017-08-08  本文已影响123人  LFDevJourney

1. SourceCode:

Repo on github/EsptouchForAndroid

2. Integration

a). 拷贝以下 Java 文件到自己的工程,注意文件中的import 路径需要做相应修改。

拷贝java class 到自己的工程

b). 拷贝esptouch_demo_activity.xml到自己的layout目录。同时将相关strings.xml中的string添加到自己工程中,拷贝arrays.xmlvalues目录.

c). 修改AndroidManifest.xml
添加如下:

 <activity
     android:name="com.xxxxxx.app.EsptouchDemoActivity"
         android:screenOrientation="portrait"
     android:label="@string/app_name" >
     <intent-filter>
          <action android:name="android.intent.action.MAIN" />
           <category >android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
 </activity>

d). 切换到Smart config 的EsptouchDemoActivity

    public void smartConfig() {
        Intent  intent= new Intent(getApplicationContext(), EsptouchDemoActivity.class);
        //Log.d("INFO", "before start activity");
        startActivity(intent);
    }

e). 回到之前的activity
在config页面可以添加一个返回的Button,

在EsptouchDemoActivity 中监听Button的click event

    mBtnBack = (Button) findViewById(R.id.btnBack);
    mBtnBack.setOnClickListener(this);

在onClick 函数中添加如下,来结束当前Activity。

    if (v == mBtnBack) {
        this.finish();
    }

上面只是一个简单的集成,仅供参考。

上一篇 下一篇

猜你喜欢

热点阅读