Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在android中购买应用内计费之前,如何锁定我的列表视图?_Java_Android - Fatal编程技术网

Java 在android中购买应用内计费之前,如何锁定我的列表视图?

Java 在android中购买应用内计费之前,如何锁定我的列表视图?,java,android,Java,Android,如何在购买应用程序之前锁定列表视图 我的列表视图有250个故事,我希望这样,当用户第一次使用我的应用程序时,他/她只能阅读20个故事。当用户购买应用程序时,他/她可以读取列表视图中的所有项目 我的列表视图: @Override protected void onListItemClick(List View l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Story s

如何在购买应用程序之前锁定列表视图

我的列表视图有250个故事,我希望这样,当用户第一次使用我的应用程序时,他/她只能阅读20个故事。当用户购买应用程序时,他/她可以读取列表视图中的所有项目

我的列表视图:

@Override
protected void onListItemClick(List View l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Story story = story's.get(position);

    Intent next = new Intent(this,Show Story.class); 
    next.put Extra("this story", story);
    start Activity(next);
}

您必须检查以下条件

if(position>20 && story's.get(position) is not purchased)
{
    // open in app purchase screen
}
else
{
    Story story = story's.get(position);

    Intent next = new Intent(this,Show Story.class); 
    next.put Extra("this story", story);
    start Activity(next);
}

我的应用程序中的真实购买等于m为Premium=真实;以及如何编辑此代码;s如果(position>20&&story's.get(position)未购买)@M.Mshki,表示您需要管理该特定position上项目的标志(是否购买)。@M.Mshki,添加此条件-如果(position>20&&Premium!=true)@M.Mshki,您是否获得解决方案?尚未。如果(position>20&&Premium!=true)不需要其他语法问题,则问题已修复。