其他分享
首页 > 其他分享> > android – taskstackbuilder for api 14

android – taskstackbuilder for api 14

作者:互联网

我的编译器显示此消息…

Call required API level 16 (current min is 14)

问题是……“这个代码可以在api 14中运行吗?”
因为我没有设备来测试这个API版本,因为AVD没有GPS(要求)
我是否必须实现支持库?

注意

它在API 16及更高版本上运行良好

TaskStackBuilder

    PendingIntent contentIntent = TaskStackBuilder.create(this)
            // add all of DetailsActivity's parents to the stack,
            // followed by DetailsActivity itself
            .addParentStack(Activity_TrackingMode.class)
            .addNextIntent(new Intent(this, Activity_TrackingMode.class))
            .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

AndroidManifest

    <activity android:name=".Activity_TrackingMode"
              android:label="@string/app_name"
              android:screenOrientation="portrait"
              android:parentActivityName=".Activity_Screen1">
        <!-- Parent activity meta-data to support 4.0 and lower -->
        <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".Activity_Screen1" />
        <intent-filter>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>

解决方法:

你必须使用android.support.v4.app.TaskStackBuider

http://developer.android.com/reference/android/support/v4/app/TaskStackBuilder.html

在API 14上运行

标签:android,activity-stack
来源: https://codeday.me/bug/20190717/1490373.html