1. Check out our app, Forums for Android! Download and leave feedback here!

App within an app

Discussion in 'Android Apps & Games' started by Philleh, Nov 11, 2010.

  1. Philleh

    Philleh Member
    Thread Starter
    5

    Oct 16, 2010
    7
    0
    5
    Hi guys, building a program with a number of menu options. One of them I want to launch another app. I tried using intents code but seem to keep getting an error. Heres my code.

    package com.androidbook.prototype;

    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.AdapterView;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    import android.widget.TextView;

    public class FYPMenuActivity extends FYPActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.menu);
    ListView menuList = (ListView) findViewById(R.id.ListView_Menu);
    String[] items = { getResources().getString(R.string.menu_item_setlaunch),
    getResources().getString(R.string.menu_item_scweb),
    getResources().getString(R.string.menu_item_settings),
    getResources().getString(R.string.menu_item_help) };
    ArrayAdapter<String> adapt = new ArrayAdapter<String>(this, R.layout.menu_item, items);
    menuList.setAdapter(adapt);
    menuList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    public void onItemClick(AdapterView<?> parent, View itemClicked, int position, long id) {
    TextView textView = (TextView) itemClicked;
    String strText = textView.getText().toString();
    if (strText.equalsIgnoreCase(getResources().getString(R.string.menu_item_setlaunch))) {
    // Launch astro file manager example problems *******
    startActivity(new Intent(FYPMenuActivity.this, FYPSetupActivity.class));
    // Intent i = new Intent(Intent.ACTION_MAIN);
    //i.addCategory(Intent.CATEGORY_LAUNCHER);
    //i.setPackage("com.metego.astro");
    //startActivity(i);

    } else if (strText.equalsIgnoreCase(getResources().getString(R.string.menu_item_help))) {
    // Launch the Help Activity
    startActivity(new Intent(FYPMenuActivity.this, FYPHelpActivity.class));

    EDIT:

    Without the commented code, [the intent stuff after * startActivity(new Intent(FYPMenuActivity.this, FYPSetupActivity.class));] the app (Im following a book tutorial) brings you to a plain default text xml screen. I want it to launch an app thats installed on the phone. There's other menu options too, but I want the first option to launch astro file manager - (or any app really, for the moment - just to get it working!)

    Can anyone advise?

    Thanks!
     

    Advertisement

  2. reinbeau

    reinbeau Klaatu barada nikto
    163

    Sep 14, 2010
    1,333
    218
    163
    Pilates Instructor
    South of Boston, MA
    I'm not a developer, but I've downloaded your app and ran into a problem right off. There was a notification, but when I tap on that notification I want to read it - not be brought to information on the person who has commented on my photo. I really want a good Facebook app, the frustration level with this is driving me crazy. Can you fix this?
     
  3. takeshi

    takeshi Well-Known Member
    163

    Dec 6, 2009
    3,354
    282
    163
    You'll have better luck in a developer forum.
     
  4. Philleh

    Philleh Member
    Thread Starter
    5

    Oct 16, 2010
    7
    0
    5

    Thanks, can you recommend one?
     

Share This Page

Loading...