findviewbyid

    0熱度

    2回答

    Error:(43, 35) error: no suitable method found for findViewById(TextView) method Activity.findViewById(int) is not applicable (argument mismatch; TextView cannot be converted to int) method AppCompatA

    -1熱度

    1回答

    public class HomeFragment extends BasePageFragment { private Unbinder unbinder; // @BindView(R.id.fab) // FloatingActionButton mFab; @Nullable @Override public View onCreateView(LayoutInf

    -2熱度

    1回答

    在棉花糖中,一切都按原樣運作。然而,在牛軋糖,我得到一個void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference錯誤。該currentWorkoutDisplay保持爲空,即使TextView currentWorkoutDisplay = (TextView) findView

    -2熱度

    1回答

    我是Android Studio的新手,剛剛嘗試學習新的代碼方式,現在我被卡住了。例如,我想在findViewById中使用一個字符串。 public void BDate0(String BId, String BHistoryClass) { bdatum0 = (Button) findViewById(R.id.BId); bdatum0.setOnClickLis

    0熱度

    1回答

    我在我的應用程序中遇到了一個奇怪的問題。我想從另一個類(不是活動)更新TextViews。我可以通過以下兩種方式調用getUpdate()方法: 這就是我從MainActivity調用它們的方式: 這種方式可以正常工作。 public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId();

    0熱度

    1回答

    創建對話框我收到此錯誤java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference 我嘗試設置文本後,但沒有運氣改變的setContentView。 即

    -10熱度

    1回答

    我對findViewById得到一個錯誤。下面是代碼: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bag_setting); } } pub

    -1熱度

    1回答

    首先,我搜索了許多其他帖子,但仍未找到修復方法。 MainActivity是選項卡式活動(2個選項卡),第一個包含ListView。該列表中的單個項目由custom_row佈局文件製成,其包含ImageView,其編號爲deleteItemImage。 如何在Tab1_class中使用findViewById從自定義佈局文件中獲取對該圖像的引用,以便能夠setOnClickListener(...

    0熱度

    2回答

    我想從另一個java類處理主要活動元素,如TextView或Radiobutton。還獲取有關文本的信息,如getText()函數。 我該怎麼做? public class main_activity extends AppCompatActivity { Button query; BusTimer bus_timer = new BusTimer(); protected void

    1熱度

    1回答

    我有這個問題的片段..我想在我的應用程序中添加一個抽屜菜單,並與片段的工作。我有這個代碼,當我把碎片「findviewbyid」沒有工作更多。有人可以幫助我嗎? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.lay