3
我要瘋狂的Android編程。沒有什麼工作正常..意圖和putExtra不起作用
這是怎麼回事?
錯誤:getIntent() is undefined for type View
任何想法?
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_quiz, container,
false);
TextView text = (TextView)rootView.findViewById(R.id.ttv);
Bundle intentBundle = rootView.getIntent().getExtras();
int question_cat = intentBundle.getInt("question_cat");
text.setText(question_cat);
return rootView;
}
}
沒有一本書似乎真的能從零開始工作。很難學習正常活動的所有概念,然後用碎片進行工作。 – Philip
真的..即使開發者的網站有點混亂。每當我懷疑我看到這個網站上的帖子,或者我更願意尋找:http://www.vogella.com/tutorials/android.html 反正,這個答案是否適合你? – mike20132013
它,工作得很好。儘管我在這裏獲得解決方案並不是很滿意,但大部分都不瞭解。現在我需要找出如何創建一個標籤欄。我不期待它 – Philip