第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

找不到具有findViewById()的視圖

找不到具有findViewById()的視圖

拉風的咖菲貓 2019-11-06 12:05:36
找不到具有findViewById()的視圖我找不到TextView打電話findViewById()即使ID確實存在。OtherActivity:public class OtherActivity extends Activity {      @Override     protected void onCreate(Bundle savedInstanceState) {         TextView textView = (TextView)findViewById(R.ID.txt02);         super.onCreate(savedInstanceState);//line 5         setContentView(R.layout.other_activity);         //textView.setText(ACCESSIBILITY_SERVICE);         Button button = (Button)findViewById(R.ID.otherActivity_Btn);         button.setText(R.string.otherActivityBtn);         button.setOnClickListener(new GoBackBtnListener(this));     }     class GoBackBtnListener implements OnClickListener {         OtherActivity other = null;         public GoBackBtnListener(OtherActivity p_other) {             other = p_other;         }         public void onClick(View v) {             Intent intent = new Intent();             intent.setClass(other, Activity01Activity.class);             other.startActivity(intent);         }     }}我在第5行添加了一個斷點,并以調(diào)試模式啟動了該項目。當它在斷點停止時,我將鼠標移動到變量。textView它是空的。這個other_activity布局:<?xml version="1.0" encoding="utf-8"?><LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"   android:orientation="vertical"   android:layout_width="fill_parent"   android:layout_height="fill_parent"><TextView      android:id="@+ID/txt02"     android:layout_width="fill_parent"     android:layout_height="wrap_content"/><Button      android:id="@+ID/otherActivity_Btn"     android:layout_width="fill_parent"     android:layout_height="wrap_content"/></LinearLayout>我不認為TextView不應(yīng)該被找到,但是為什么變量是textView零?
查看完整描述

3 回答

?
交互式愛情

TA貢獻1712條經(jīng)驗 獲得超3個贊

實際上,我只是遇到了這個問題,它是由現(xiàn)在的構(gòu)建自動檢查引起的。只需手動構(gòu)建您的項目,或單擊“自動生成”,就可以解決您的問題!

查看完整回答
反對 回復 2019-11-07
  • 3 回答
  • 0 關(guān)注
  • 612 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號