android - Checking existence of an Activity -
i considering code in this question, , did following:
first, create simple, empty project 1 activity
called mainactivity
, in package com.example.plugins
. compile project , install device. app works fine.
then, in project have code:
intent plugins = new intent(); plugins.setclassname("com.example.plugins", "mainactivity"); list<resolveinfo> list = getpackagemanager().queryintentactivities(plugins, packagemanager.match_default_only); if (list.size() > 0) { tvtext.settext("plugins."); } else { tvtext.settext("no plugins."); }
i'd should work, doesn't. gives "no plugins". missing here?
update when using
packageinfo pi = getpackagemanager().getpackageinfo( "com.example.plugins", packagemanager.get_activities);
i activities other app.
i think mime-type of intent missing.
plugins.settype("text/plain");
Comments
Post a Comment