Meaningless Drivel is fun!*
The moose likes Android and the fly likes How to Start New Activity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to Start New Activity" Watch "How to Start New Activity" New topic
Author

How to Start New Activity

Muhammad Imad Qureshi
Ranch Hand

Joined: Sep 13, 2005
Posts: 238
How do I start new activity from an activity. I want to start a new activity from on click listener. Basically, I have a class that extends "Activity" and I would like to call its onClick method but I do not have a Bundle object available.

Thanks
Imad
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi Imad,

Just use,


Thanks
Pratik Goswami


iOS * Android Developer
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

You should consider reading this and maybe bookmark it. You can find answer to your question under the question: Opening a new screen


[List of FAQs] | [Android FAQ] | [Samuh Varta]
Muhammad Imad Qureshi
Ranch Hand

Joined: Sep 13, 2005
Posts: 238
Thanks a lot for your reply. Now I am getting following error although I have added activity to my manifest file.

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.imad.futureValue/FutureValueFunction}; have you declared this activity in your AndroidManifest.xml?

Here is my manifest file. Future Value is actually started by payment function.

Thanks
Imad

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.imad.paymentFunction"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".PaymentFunction"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name="com.android.imad.futureValue.FutureValueFunction"
android:label="@string/fvText">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="6" />

</manifest>
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

A few things :
1. Use code tags when posting code, it improves readability.(You can use the Edit Button)
2. Note that only one of the activity should be having :
in their intent filter, other wise you will see two different icons for your application in the Launcher menu.
3. Can you also post the code you used to start the new Activity?
Muhammad Imad Qureshi
Ranch Hand

Joined: Sep 13, 2005
Posts: 238
Thank you so much Monu. I resolved this problem and this is how I am doing it now.



and in my java file I have


Would you like to add any suggestion to this?
Thanks
Imad
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Looks good to me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Start New Activity