How to display menus of one application in to another applic

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

How to display menus of one application in to another applic

Postby baskar » Thu Jan 10, 2008 5:08 am

Hi,

please help me..

I want to display menus of one application in to another application.

I try these method but could not display other application menus.

Suppose I have two Application Sample1 and Sample2.

whenever I Focus my Sample2 EditTextArea it should automatically display Sample1 menus in Sample2.

My Coding is.

1.Sample1

Below code I used to Sample1.java

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public boolean onCreateOptionsMenu(Menu menu){
  2.  
  3.         super.onCreateOptionsMenu(menu);
  4.  
  5.         menu.add(0, 0, "message1");
  6.  
  7.         menu.add(0, 1, "message2");
  8.  
  9.         menu.add(0, 2, "message3");
  10.  
  11.         menu.add(0, 3, "message4");
  12.  
  13.         return true;
  14.  
  15.     }
  16.  
  17.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

AndroidManifest.xml in Sample1 project

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    package="com.google.android.Sample1">
  6.  
  7.        <application android:icon="@drawable/icon">
  8.  
  9.         <activity class=".Samplemenu">                
  10.  
  11.                 <intent-filter label="EditText">      
  12.  
  13.                         <action android:value="com.google.android.Sample1" />
  14.  
  15.                                 <type android:value="text/*" />                
  16.  
  17.                                 <category android:value="android.intent.category.ALTERNATIVE" />
  18.  
  19.                         <category android:value="android.intent.category.SELECTED_ALTERNATIVE" />
  20.  
  21.                 </intent-filter>
  22.  
  23.         </activity >
  24.  
  25.        </application>
  26.  
  27. </manifest>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


2.Sample2 project

Below code I used to Sample2.java

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override public boolean
  2.  
  3. onCreateOptionsMenu(Menu menu)
  4.  
  5. {
  6.  
  7.         super.onCreateOptionsMenu(menu);
  8.  
  9.         menu.add(0, 0, "Menu1");
  10.  
  11.         menu.add(0, 1, "Menu2");
  12.  
  13.         menu.add(0, 2, "Menu3");
  14.  
  15.         Intent intent = new Intent(null, getIntent().getData());
  16.  
  17.         intent.addCategory(Intent.ALTERNATIVE_CATEGORY);
  18.  
  19.         menu.addIntentOptions(Menu.ALTERNATIVE,0,new ComponentName("Sample1","Sample2"),null,intent,0,null);
  20.  
  21.         return true;
  22.  
  23. }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
baskar
Developer
Developer
 
Posts: 46
Joined: Wed Dec 26, 2007 6:03 am
Location: India

Top

Return to General

Who is online

Users browsing this forum: MatteWorks and 1 guest