Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8363387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:09:49+00:00 2026-06-09T12:09:49+00:00

I was found AndroidFragment tutorial on Vogel site, and do it for Android 4.0.

  • 0

I was found AndroidFragment tutorial on Vogel site, and do it for Android 4.0. Then I try to port it to lower version, API 8 for example.

All time when i startmy app i have ClassNotFound Exception

Please help me to fix error.

There is my MainActivity file:

package com.dev.fragments;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;


public class MainActivity extends FragmentActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

}

There is my main.xml file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <fragment
        android:id="@+id/listFragment"
        android:layout_width="150dip"
        android:layout_height="match_parent"
        android:layout_marginTop="?android:attr/actionBarSize"
        class="com.dev.fragments.ListFragment" ></fragment>

    <fragment
        android:id="@+id/detailFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.dev.fragments.DetailFragment" >
        <!-- Preview: layout=@layout/details -->
    </fragment>

</LinearLayout> 

There is my ListFragment file:

package com.dev.fragments;

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

public class ListFragment extends android.support.v4.app.ListFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
                "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
                "Linux", "OS/2" };
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
                android.R.layout.simple_list_item_1, values);
        setListAdapter(adapter);
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        String item = (String) getListAdapter().getItem(position);
        DetailFragment fragment = (DetailFragment) getFragmentManager()
                .findFragmentById(R.id.detailFragment);
        if (fragment != null && fragment.isInLayout()) {
            fragment.setText(item);
        } else {
            Intent intent = new Intent(getActivity().getApplicationContext(),
                    DetailActivity.class);
            intent.putExtra("value", item);
            startActivity(intent);

        }

    }
}

There is my DetailFragment file:

package com.dev.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


public class DetailFragment extends Fragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e("Test", "hello");
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.details, container, false);
        return view;
    }

    public void setText(String item) {
        TextView view = (TextView) getView().findViewById(R.id.detailsText);
        view.setText(item);
    }

}

There is my ManifestFile:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.dev.fragments"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="15" />

    <application
        android:label="@string/app_name">
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".DetailActivity"></activity>
    </application>

</manifest>

And there is my error:

08-08 08:55:02.126: E/AndroidRuntime(454): FATAL EXCEPTION: main
08-08 08:55:02.126: E/AndroidRuntime(454): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.dev.fragments/com.dev.fragments.MainActivity}: java.lang.ClassNotFoundException: com.dev.fragments.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.dev.fragments-2.apk]
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.os.Looper.loop(Looper.java:123)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.app.ActivityThread.main(ActivityThread.java:4627)
08-08 08:55:02.126: E/AndroidRuntime(454):  at java.lang.reflect.Method.invokeNative(Native Method)
08-08 08:55:02.126: E/AndroidRuntime(454):  at java.lang.reflect.Method.invoke(Method.java:521)
08-08 08:55:02.126: E/AndroidRuntime(454):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-08 08:55:02.126: E/AndroidRuntime(454):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-08 08:55:02.126: E/AndroidRuntime(454):  at dalvik.system.NativeStart.main(Native Method)
08-08 08:55:02.126: E/AndroidRuntime(454): Caused by: java.lang.ClassNotFoundException: com.dev.fragments.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.dev.fragments-2.apk]
08-08 08:55:02.126: E/AndroidRuntime(454):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
08-08 08:55:02.126: E/AndroidRuntime(454):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
08-08 08:55:02.126: E/AndroidRuntime(454):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
08-08 08:55:02.126: E/AndroidRuntime(454):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:09:50+00:00Added an answer on June 9, 2026 at 12:09 pm

    This is an logcat error I guess?

    I’m not trained with portation of the v4 support packages, but It seems like your MainActivity isn’t deployed correctly and though not correctly put into the com.dev.fragments-2.apk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a tutorial to create android custom button : http://developer.android.com/resources/tutorials/views/hello-formstuff.html#CustomButton What is the
Found the following in the example code appserver.cpp distributed with UDT hints.ai_flags = AI_PASSIVE;
I found this tutorial on using WIA in c++, but I don't understand how
Found this code on http://www.docjar.com/html/api/java/util/HashMap.java.html after searching for a HashMap implementation. 264 static int
Found a bug in IE (all versions), wondering if there is a workaround. This
Found several good(related) questions here and here but all are nearly a year old.
Found this snippet on a site that is very well designed (http://www.distinctlydeutschland.com/): @font-face {
found from predefined constants . what is the (integer) means? why all (integer)? PDO::PARAM_BOOL
Found this while reading the Neo4j manual, specifically here , I found the sentence:
Found related questions but not the exact variant so I am posting a very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.