Android: Start Activity from preferences.xml

后端 未结 12 2005
轮回少年
轮回少年 2020-12-04 13:16

I would like to start an Activity from a default preferences.xml, with < intent > tag. The Activities are well tested, the problem is not with that. (I\'m extending Prefe

12条回答
  •  被撕碎了的回忆
    2020-12-04 13:45

    This solution shows you how to wire in an activity into your preferences headers.

    First, your target activity must be declared in the manifest like this:

    
        
            
            
    
    
    

    Notice here that the android:name for the activity and action are the same.

    Now in your preferences.xml file you need only to declare a header like this:

    And that's all there is to it.

提交回复
热议问题