1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

App within an app


Last Updated:

  1. Philleh

    Philleh Member This Topic's Starter

    Joined:
    Oct 16, 2010
    Messages:
    7
    Likes Received:
    0
    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 VIP Member

    Joined:
    Sep 14, 2010
    Messages:
    1,333
    Likes Received:
    218
    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

    Joined:
    Dec 6, 2009
    Messages:
    3,354
    Likes Received:
    281
    You'll have better luck in a developer forum.
     
  4. Philleh

    Philleh Member This Topic's Starter

    Joined:
    Oct 16, 2010
    Messages:
    7
    Likes Received:
    0

    Thanks, can you recommend one?
     

Share This Page

Loading...