Android Studio 開(kāi)發(fā)學(xué)習(xí)日志-1

標(biāo)簽: Android AndroidStudio Java


學(xué)習(xí)上的直接感受非常像是在學(xué)習(xí)VB的感受,但是比VB功能要高級(jí)很多。

3月18號(hào)的夜里11點(diǎn)-凌晨2點(diǎn),無(wú)法運(yùn)行ActivityLifeCycleTest項(xiàng)目??!

到現(xiàn)在時(shí)間11點(diǎn),就剛才解決了問(wèn)題!

一開(kāi)始是代碼錯(cuò)誤,缺少了一行TAG中的代碼!

public class MainActivity extends Activity {

    public static final String TAG ="MainActivity" ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    

然后重新編寫(xiě)了一遍代碼,還是無(wú)法運(yùn)行,來(lái)回核對(duì)了很多次代碼!

無(wú)果!??!

查看LogCat,太復(fù)雜,還沒(méi)有學(xué)會(huì)如何查找問(wèn)題,最后學(xué)會(huì)了使用Android Studio中的EventLog查看!好用?。?!

屏幕截圖(73).png

查找到問(wèn)題所在

Could not identify launch Activity: Default Activity not found

所以,
交給偉大的搜索引擎“baidu”,“Google”?。?/p>

還是http://stackoverflow.com/能夠及時(shí)解決問(wèn)題!
APP雖然沒(méi)有報(bào)錯(cuò)了,但是無(wú)法啟動(dòng)的原因是缺少

<intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

至此,問(wèn)題解除!!

《第一行代碼》還是一個(gè)非常適合初學(xué)者學(xué)習(xí)Android開(kāi)發(fā)啟蒙讀物,配圖完整,指代詳細(xì)。
可能是我用的是AndroidStudio的緣故,亦或是我的基礎(chǔ)太差,軟件更新太快,書(shū)本這個(gè)問(wèn)題的內(nèi)容和我的練習(xí)存在稍許誤差!!

可也正是這些“誤會(huì)“,讓我更深入學(xué)習(xí)了!

這里把第一章的內(nèi)容又重新學(xué)習(xí)了一遍!!知道了為什么不能啟動(dòng)的原因!

接下來(lái)貼上書(shū)本的源碼

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.pluslee.activitylifecycletest" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >

        <activity android:name=".NormalActivity" >
        </activity>

        <activity android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog">
        </activity>

    </application>

</manifest>

以及能夠在AndroidStudio上運(yùn)行的修改后的代碼

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.pluslee.activitylifecycletest" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity android:name=".NormalActivity" >
        </activity>

        <activity android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog">
        </activity>

    </application>

</manifest>

歡迎交流學(xué)習(xí)!歡迎指正!
QQ1171668161

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容