Back to project page diagnostic-tool.
The source code is released under:
Copyright (c) 2014 Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are me...
If you think the Android project diagnostic-tool listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.openxc.openxcdiagnostic.util; /*from w w w . j a v a 2s .com*/ import java.util.HashMap; import java.util.Map; import android.app.Activity; import android.content.Intent; import com.openxc.openxcdiagnostic.R; import com.openxc.openxcdiagnostic.dash.DashboardActivity; import com.openxc.openxcdiagnostic.diagnostic.DiagnosticActivity; import com.openxc.openxcdiagnostic.dump.DumpActivity; import com.openxc.openxcdiagnostic.menu.MenuActivity; /** * * Launcher for launching other activities within the app. Allows for a lot of * logic consolidation. * */ public class ActivityLauncher { public static Map<Integer, Class<?>> sActivityMap = new HashMap<>(); static { sActivityMap.put(R.id.Diagnostic, DiagnosticActivity.class); sActivityMap.put(R.id.Menu, MenuActivity.class); sActivityMap.put(R.id.Dashboard, DashboardActivity.class); sActivityMap.put(R.id.Dump, DumpActivity.class); } public static void launchActivity(Activity activity, int itemId) { Class<?> newActivityClass = sActivityMap.get(Integer.valueOf(itemId)); if (!activity.getClass().equals(newActivityClass)) { activity.startActivity(new Intent(activity, newActivityClass)); } } }