I have already lost 2 days in this problem, please provide any help you can.
I have an Android application which displays 2 Android Activity icons: "Comp 1" and "Comp 2".
Both "Comp 1" and "Comp 2" shows TabActivities with tabs within.
Problem:
Right after deploying my application, I can enter into any of "Comp 1" or "Comp 2" TabActivity, but when I leave the activity and when I try to enter the other TabActivity, the tabs shown are the same from the previous one "Comp 1" or "Comp 2" it always depends on which I start first.
Objective:
For any of the "Comp N", open correctly the tabs assigned on the TabActivities(see code on this post).
Please, allow me to show my code.
I will show AndroidManifest.xml, TabActivity for "Comp 1" and TabActivity for "Comp 2". They're a bit extensive, so I apologize in advance for any extra and unnecessary info they may contain. I just didn't want to take risk to forget to provide any important information on the first post.
AndroidManifest.xml ("Comp 1"=MMComponentTabAssembler, "Comp 2"=TabAssembler)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="internalOnly"
package="be.multitel.android.mmnd">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".activity.TabAssembler"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.NetworkDispatcher1"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.Device"
android:label="#string/app_test_device_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.SMS"
android:label="#string/sms_app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.NetworkDispatcherActivity"
android:label="#string/test_network_dispatcher_app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<!-- Begin :: Code for standard MMComponentTabAssembler tab view.
Use this code to include new components activities that extend from MMSuperComponent.
-->
<activity android:name=".activity.MMComponentTabAssembler"
android:label="Comp 1"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.GPS"
android:label="GPS">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.GPSPreferences"
android:label="GPSPrefs">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.StandardSetupActivity"
android:label="Setup">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<!-- End :: Code for standard MMComponentTabAssembler tab view. -->
<service android:exported="true" android:name=".service.NetworkDispatcherService" android:process=":remote">
<intent-filter>
<action android:name="NetworkDispatcherService">
</action>
</intent-filter>
</service>
<service android:exported="true" android:name=".service.NetHubService" android:process=":remote"/>
<receiver android:name=".service.utils.NetworkListener">
<intent-filter>
<action android:name=
"android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name=
"android.provider.Telephony.SMS_RECEIVED" />
<action android:name=
"be.multitel.android.mmnd.service.utils.SocketListener.ACK_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name=".service.utils.MMNetworkDispatcherReceiver" >
<intent-filter>
<action android:name=
"android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name=
"CONNECTIVITY_CHANGE" />
<action android:name=
"android.provider.Telephony.SMS_RECEIVED" />
<action android:name=
"be.multitel.android.mmnd.service.utils.SocketListener.ACK_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name=".service.utils.MMReceiver" >
<intent-filter>
<action android:name="ACTION_MM_CONNECT" />
<action android:name="ACTION_MM_DISCONNECT" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESREQ" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESRELEASE" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESINFOREQ" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_BWINFOREQ" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_LATENCYINFOREQ" />
<category android:name="COMPONENT_CATEGORY_GPS"/>
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
"Comp 1" TabActivity = MMComponentTabAssembler
public class MMComponentTabAssembler extends TabActivity {
public static final String TAG = MMComponentTabAssembler.class.getName();
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.standard_tabbed_pane);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
//Multimodal component tab
intent = new Intent().setClass(this, GPS.class);
intent.addCategory(Const.COMPONENT_CATEGORY_GPS); //Used to produce Intents to the MMComponent
intent.addCategory(Const.ACTIVITY_CATEGORY_GPS); //Used to consume Intents on the BroadcastReceiver associated to the Activity
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("gps").setIndicator("GPS",
res.getDrawable(R.drawable.ic_tab_gps))
.setContent(intent);
tabHost.addTab(spec);
//preferences tab
intent = new Intent().setClass(this, GPSPreferences.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("gpsPrefs").setIndicator("GPSPrefs",
res.getDrawable(R.drawable.ic_tab_gpsprefs))
.setContent(intent);
tabHost.addTab(spec);
//standard setup tab
intent = new Intent().setClass(this, StandardSetupActivity.class);
intent.addCategory(Const.COMPONENT_CATEGORY_GPS); //Used to produce Intents to the MMComponent
intent.addCategory(Const.ACTIVITY_CATEGORY_GPS); //Used to consume Intents on the BroadcastReceiver associated to the Activity
spec = tabHost.newTabSpec("standard_setup_tab").setIndicator("Setup",
res.getDrawable(R.drawable.ic_tab_standard_setup))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
#Override
protected void onResume() {
super.onResume();
Log.d(TAG,"Activity group lifecicle :: onResume().");
}
#Override
protected void onPause() {
super.onPause();
Log.d(TAG,"Activity group lifecicle :: onPause().");
}
#Override
protected void onStop() {
super.onStop();
Log.d(TAG,"Activity group lifecicle :: onStop().");
}
#Override
protected void onDestroy() {
super.onDestroy();
Log.d(TAG,"Activity group lifecicle :: onDestroy().");
}
}
"Comp 2" TabActivity = TabAssembler
public class TabAssembler extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_tab);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
intent = new Intent().setClass(this, NetworkDispatcher1.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("netword_dispatcher").setIndicator("NDispatcher",
res.getDrawable(R.drawable.ic_tab_mmnd))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, Device.class);
spec = tabHost.newTabSpec("test_device").setIndicator("Test Device",
res.getDrawable(R.drawable.ic_tab_test_device))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, SMS.class);
spec = tabHost.newTabSpec("test_sms").setIndicator("SMS",
res.getDrawable(R.drawable.ic_tab_sms))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, NetworkDispatcherActivity.class);
spec = tabHost.newTabSpec("test_network_dispatcher").setIndicator("Test ND",
res.getDrawable(R.drawable.ic_tab_test_network_dispatcher))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(3);
}
}
Only one of activity set
And others should set something else, such as
Then only one activity assigned the icon.
Related
I want to start my application whenever the phone is unlocked.
Below is my code which works fine when the phone is restarted, but I also want it to work whenever the phone is unlocked.
What should I do?
I want to start my application every time the user unlocks the phone. What did I do wrong in my code?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.installedapps22"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application android:icon="#drawable/cherry_icon" android:label="#string/app_name">
<activity android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".BootUpReciever" android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.SCREEN_OFF" />
<action android:name="android.intent.action.SCREEN_ON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity android:name=".ListInstalledApps" > </activity>
<activity android:name=".TabsLayoutActivity" />
</application>
</manifest>
public class BootUpReciever extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
System.out.println("in broad....");
if ((intent.getAction() != null) &&
(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")))
{
System.out.println("in broadcast receiver.....");
Intent i = new Intent(context, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
Intent i = new Intent(context, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
check manifist file
<activity
android:name="com.wallop.tech.MyAndroidAppActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:name="Startup" >
<intent-filter android:enabled="true" android:exported="false">
<action android:name="android.intent.action.SCREEN_ON" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.intent.action.SCREEN_OFF"/>
</intent-filter>
</receiver>
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class Startup extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction() != null) {
if( intent.getAction().equals(Intent.ACTION_USER_PRESENT)) {
Intent s = new Intent(context, MyAndroidAppActivity.class);
s.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(s);
}
}
}
}
I am creating a Jigsaw Puzzle application in android. I have created two activites, activity_jigsaw.xml and activity_level.xml. One activity is created by default (Displaying Hello World!) which I modified and created a new activity by following these steps:
File -> New -> Other -> Android Activity
But when I install the application these two files (and all other activities of the application) are installed as a separate project. But at the same time they are also interlinked. The Java code of the files as follows:
Jisaw.java file contains:
public class Jigsaw extends Activity {
Intent intent;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jigsaw);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_jigsaw, menu);
return true;
}
public void play(View v)
{
try
{
intent = new Intent(this, Level.class);
startActivity(intent);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Here Play is a function which is called when an image is clicked.
Level.java file contains:
public class Level extends Activity {
Intent intent;
String level = "";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_level, menu);
return true;
}
public void easy(View v)
{
level = "easy";
intent = new Intent(this, Play.class);
intent.putExtra("level", level);
startActivity(intent);
}
public void medium(View v)
{
level = "medium";
intent = new Intent(this, Play.class);
intent.putExtra("level", level);
startActivity(intent);
}
public void hard(View v)
{
level = "hard";
intent = new Intent(this, Play.class);
intent.putExtra("level", level);
startActivity(intent);
}
}
Functions easy, medium and hard are called when a corresponding image is clicked.
Can somebody please tell me that what I am doing wrong?
Thanks in advance..
Here is the manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maju.jigsawpuzzle"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Jigsaw"
android:label="#string/title_activity_jigsaw" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Level"
android:label="#string/title_activity_level" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Play"
android:label="#string/title_activity_play" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PlayBoard"
android:label="#string/title_activity_play_board" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You probably are defining android.intent.category.LAUNCHER intent category to all the activities in your AndroidManifest.xml, it creates an icon in the app launcher. Activities other than main should not have this intent filter.
Do something like this:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity android:name=".JigSaw" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Level" />
<activity android:name=".Play" />
<activity android:name=".Playboard" />
</application>
EDIT:
As you just posted, you are indeed doing that, just remove the intent filter from other activities.
1This is my code snippet
TabHost tabHost = getTabHost();
TabSpec aboutus = tabHost.newTabSpec("About us");
aboutus.setIndicator("___", getResources().getDrawable(R.drawable.icon_aboutus_tab));
Intent photosIntent = new Intent(getApplicationContext(), readmore.class);
aboutus.setContent(photosIntent);
TabSpec contactus = tabHost.newTabSpec("Contact us");
// setting Title and Icon for the Tab
contactus.setIndicator("___", getResources().getDrawable(R.drawable.icon_contactus_tab));
Intent songsIntent = new Intent(getApplicationContext(), contactus.class);
contactus.setContent(songsIntent);
TabSpec orderhistory = tabHost.newTabSpec("Order history");
orderhistory.setIndicator("___", getResources().getDrawable(R.drawable.icon_orderhistory_tab));
Intent videosIntent = new Intent(getApplicationContext(), readmore.class);
orderhistory.setContent(videosIntent);
TabSpec home = tabHost.newTabSpec("Home");
home.setIndicator("___", getResources().getDrawable(R.drawable.icon_home_tab));
Intent homeIntent = new Intent(getApplicationContext(), Mainpage.class);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
home.setContent(homeIntent);
// Adding all TabSpec to TabHost
tabHost.addTab(aboutus); // Adding about us tab
tabHost.addTab(contactus); // Adding contact us tab
tabHost.addTab(orderhistory); // Adding order history tab
tabHost.addTab(home);
The Intent is not overriding the main activity.
how am i supposed to override it.
This is my manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.xmlparsing"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CLEAR_APP_CACHE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/zaggleicon"
android:label="#string/app_name"
android:name=".MyApplication"
android:theme="#android:style/Theme.Light"
>`<activity
android:label="#string/app_name"
android:name=".AndroidTabLayoutActivity" >
<intent-filter >
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>`<activity
android:label="#string/app_name"
android:name=".readmore" >
<intent-filter >
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>` <activity android:name=".Mainpage">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>`<activity
android:label="#string/app_name"
android:name=".contactus" >
<intent-filter >
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>`
From my image it is showing that when i press the button the activit is showing in particular portion and the last activity remains same in the activity.So how to override that activty when i press the tab button.
Simply declare you tab's activities as per below -
<activity
android:label="#string/app_name"
android:name=".readmore"> </activity>
<activity android:name=".Mainpage"></activity>
<activity
android:label="#string/app_name"
android:name=".contactus" ></activity>
And, have a look at TabLayout tutorial.
I'm trying to write a simple app, and follow the ApiDemos sample. My app is crashing on startup. I suspect a problem with my manifest, but I'm not sure. Any ideas please?
public class managerActivity extends DeviceAdminReceiver {
public class Controller extends Activity {
static final int RESULT_ENABLE = 1;
DevicePolicyManager mDPM;
ActivityManager mAM;
ComponentName mDeviceAdminSample;
Button mEnableButton;
Button mDisableButton;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
mAM = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
mDeviceAdminSample = new ComponentName(Controller.this, managerActivity.class);
setContentView(R.layout.main);
}
}
and then in my manifest, I have:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="com.appname.managerActivity$Controller"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</activity>
<!-- Device Admin Samples -->
<receiver android:name="com.appname.managerActivity"
android:label="#string/sample_device_admin"
android:description="#string/sample_device_admin_description"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin"
android:resource="#xml/device_admin_sample" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>
Here's the crash:
11-11 15:20:52.310: ERROR/AndroidRuntime(553):
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.appname.manager/com.appname.managerActivity$Controller}:
java.lang.InstantiationException:
com.appname.managerActivity$Controller
The nested class cannot be created from outside of its enclosing class, unless it's static. Move your activity to a standalone class (i. e. not nested), or make the activity class static.
I've implemented the action bar found here https://github.com/johannilsson/android-actionbar and it works beautifully. However, I've added a search button and can't get it to show the search dialog. I followed the Google's search dialog tutorial to set my project up, but the dialog just won't show up. Any help?
Manifest:
<activity android:name=".HomeActivity" android:label="Intelicase Mobile" android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- enable the search dialog to send searches to SearchableActivity -->
<meta-data android:name="android.app.default_searchable"
android:value=".SearchActivity" />
</activity>
<activity android:name=".SearchActivity" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable"/>
</activity>
<meta-data android:name="android.app.default_searchable"
android:value=".SearchActivity" />
<!-- this activity enables the search dialog to initiate searches in the SearchableActivity -->
<activity android:name=".OtherActivity">
<meta-data android:name="android.app.default_searchable"
android:value=".SearchActivity" />
</activity>
Action Bar setup:
ActionBar actBar = (ActionBar) findViewById(R.id.actionbar);
actBar.setTitle("Dashboard");
actBar.setHomeAction(new ActionBar.IntentAction(HomeActivity.this, intent, R.drawable.ic_title_home_default));
intent = new Intent().setClass(this, CaseEvidenceActivity.class);
actBar.addAction(new ActionBar.IntentAction(this, intent, R.drawable.ic_title_export_default));
intent = new Intent().setClass(this, OtherActivity.class);
actBar.addAction(new ActionBar.IntentAction(this, intent, R.drawable.ic_title_search_default));
OtherActivity:
public class OtherActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search);
onSearchRequested();
}
}
searchables.xml:
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="Intelicase Mobile"
android:hint="Search Intelicase" android:searchSuggestAuthority="dictionary"
android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable>
Action Bar Setup
actionBar.addAction(new SearchMP());
private class SearchMP extends AbstractAction {
public SearchMP() {
super(R.drawable.title_search);
}
#Override
public void performAction(View view) {
onSearchRequested();
}
}