1
任何人都可以告訴我如何使用sharedPreference從不同頁面調用n個活動嗎?在android eclipse中調用多個活動
任何人都可以告訴我如何使用sharedPreference從不同頁面調用n個活動嗎?在android eclipse中調用多個活動
你可以在你的SharedPreference
中保存一個數組。這是一個example。
您的陣列可以容納您的Activities
的名稱。像:
String activityNames[] = { "Activity1" , "Activity2" , "Activity3" };
從SharedPreference
取這個數組,然後使用啓動所需Activity
:
Class selected = Class.forName("learn.myandroidapp.hr." + activityNames[someIndex]);
Intent selectedIntent = new Intent(CurrentActivity.this,selected);
startActivity(selectedIntent);
我沒給你整個代碼,但其基本思想(這是多足夠,我相信)。隨時諮詢更多。
問題現在還不清楚......修改你的questionnnn – Androiduser