Start activity from preference-headers

前端 未结 3 1145
广开言路
广开言路 2021-01-12 05:15

I\'m implementing n-layer PreferenceActivities 1st layer PreferenceActivity is loaded from preference-headers.

First header creates fragment of settings which is a P

相关标签:
3条回答
  • 2021-01-12 05:35

    if you are creating preferences using java ,then you can achieve the same result by,

    PreferenceScreen editPhoneNumbersScreen = getPreferenceManager().createPreferenceScreen(mContext);
        editPhoneNumbersScreen.setTitle(getResources().getString(R.string.change_add_emergency_numbers));
        editPhoneNumbersScreen.setSummary(getResources().getString(R.string.summary_add_no));
    
    
     Intent i = new Intent(getApplicationContext(),TargetActivity.class);
    i.putExtra("change numbers", true);
            editPhoneNumbersScreen.setIntent(i);
    
    0 讨论(0)
  • 2021-01-12 05:42
     <header android:title="Intent"
        android:summary="Launches an Intent.">
    <intent android:targetPackage="com.mycompany.myapp"
            android:targetClass="com.mycompany.myapp.ui.MyPreferenceActivity" /></header>
    

    and add the below code in mainfest file

    <activity android:name=".activities.MyActivity" 
                  android:label="@string/my_activity_title"
                  android:theme="@android:style/Theme.Black.NoTitleBar">
            <intent-filter>
               <action android:name="com.example.myapp.activities.MyActivity" />
               <category android:name="android.intent.category.DEFAULT" />
           </intent-filter>
        </activity>
    
    0 讨论(0)
  • 2021-01-12 05:47

    If you want to start an explicit Activity from your third preference then do this:

    <intent android:targetPackage="com.mycompany.myapp"
            android:targetClass="com.mycompany.myapp.ui.MyPreferenceActivity" />
    
    0 讨论(0)
提交回复
热议问题