开发者

Proper way to handle UPGRADE/BUY click in a demo/lite version of Android app

I have a demo verison of an app that I have limited features of and brings up an alert when a user picks a featuer not in the demo version alerting them it 开发者_开发知识库isn't supported in the trial and two choices, buy or no thanks.. no thanks just returns them to the app.. buy triggers a

   public void onClick(DialogInterface dialog, int which) {
                    Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                    "market://details?id=[My Commercial Product Package ID]"));
                    startActivity(marketIntent);
                    finish();
                   }

Now I don't have android marketplace on my emulator, so clickon on the buy button obviosly fails.. which I am okay with. But I want to verify that that activity will start and run, and the FINISH call after it will simply kill the demo version running, but the market app will fire up and run as expected and not be affected by the finish() call.

Is this a correct assumption or not?


Yes that code matches some code that I use in one of my apps. You are also correct to assume that the finish() call will finish the activity that you are coming from, not going to


Just remember that finish refers to a single activity, not your entire app.

Here's a good post on how to get the Market working on the emulator.

How to install Android Market App on the emulator?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜