Skip to content Skip to sidebar Skip to footer

"activity Not Found" In Android

I am using the navigation-drawer template in eclipse to do a simple Android application. I have some trouble with fragment. I declared a fragment called PresenceLog Fragment in m

Solution 1:

You have created a Fragment so you could not call it like a Activity. You need to replace a container view, properly an FrameLayout with your Fragment.

getSupportFragmentManager()
  .beginTransaction()
  .replace(R.id.content_frame, new PresenceLogFragment())
  .commit();

Solution 2:

You can't load a fragment through Intent. You have to do it using fragment manager in this way:

Fragmentfragment=newPresenceLogFragment(MainActivity.this);
FragmentManagerfragmentManager= getFragmentManager();
            FragmentTransactionft= fragmentManager.beginTransaction();                
            ft.replace(R.id.yourFragmentContainer, fragment).commit();

Solution 3:

 have you declared this activity in your AndroidManifest.xml?  

Look in your manifest and see if you have an <activity> element that has your activity registered. If not, add one.

Have a look here: http://developer.android.com/guide/topics/manifest/activity-element.html

Solution 4:

it is clear.

"have you declared this activity in your AndroidManifest.xml?"

you should check is there a tag。

see this or maybe this

Solution 5:

Please open the manifest file and declare like this:

<activityandroid:name=".MainActivity" //youractivitynameandroid:label="@string/app_name" ><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity>

if this is your lauch activity then do this otherwise do this

<activity
        android:name=".MainActivity"//your activity name
        android:label="@string/app_name" >
    </activity>

type the name of your java file which extends Activity not the Fargment. Means the Fragment which creates from that Activity java file.

Post a Comment for ""activity Not Found" In Android"