use of android.content.Intent in project android-betterpickers by code-troopers.
the class ListSamples method getData.
protected List<Map<String, Object>> getData(String prefix) {
List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(INTENT_SAMPLE);
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
if (null == list) {
return myData;
}
String[] prefixPath;
String prefixWithSlash = prefix;
if (prefix.equals("")) {
prefixPath = null;
} else {
prefixPath = prefix.split("/");
prefixWithSlash = prefix + "/";
}
int len = list.size();
Map<String, Boolean> entries = new HashMap<String, Boolean>();
for (int i = 0; i < len; i++) {
ResolveInfo info = list.get(i);
CharSequence labelSeq = info.loadLabel(pm);
String label = labelSeq != null ? labelSeq.toString() : info.activityInfo.name;
if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) {
String[] labelPath = label.split("/");
String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length];
if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) {
addItem(myData, nextLabel, activityIntent(info.activityInfo.applicationInfo.packageName, info.activityInfo.name));
} else {
if (entries.get(nextLabel) == null) {
addItem(myData, nextLabel, browseIntent(prefix.equals("") ? nextLabel : prefix + "/" + nextLabel));
entries.put(nextLabel, true);
}
}
}
}
Collections.sort(myData, NAME_COMPARATOR);
return myData;
}
use of android.content.Intent in project android-betterpickers by code-troopers.
the class ListSamples method activityIntent.
protected Intent activityIntent(String pkg, String componentName) {
Intent result = new Intent();
result.setClassName(pkg, componentName);
return result;
}
use of android.content.Intent in project cw-omnibus by commonsguy.
the class EU4You method onCountrySelected.
@Override
public void onCountrySelected(Country c) {
String url = getString(c.url);
if (details != null && details.isVisible()) {
details.loadUrl(url);
} else {
Intent i = new Intent(this, DetailsActivity.class);
i.putExtra(DetailsActivity.EXTRA_URL, url);
startActivity(i);
}
}
use of android.content.Intent in project cw-omnibus by commonsguy.
the class EU4You method onCountrySelected.
@Override
public void onCountrySelected(Country c) {
String url = getString(c.url);
if (details != null && details.isVisible()) {
details.loadUrl(url);
} else {
Intent i = new Intent(this, DetailsActivity.class);
i.putExtra(DetailsActivity.EXTRA_URL, url);
startActivity(i);
}
}
use of android.content.Intent in project cw-omnibus by commonsguy.
the class DownloaderDemo method doTheDownload.
public void doTheDownload() {
Intent i = new Intent(this, Downloader.class);
i.setData(Uri.parse("https://commonsware.com/Android/excerpt.pdf"));
i.putExtra(Downloader.EXTRA_MESSENGER, new Messenger(handler));
startService(i);
}
Aggregations