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 7078539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:33:37+00:00 2026-05-28T06:33:37+00:00

I’m currently working on an Android application. I wish to have a GridView on

  • 0

I’m currently working on an Android application. I wish to have a GridView on the left side of the screen, and a MapView on the right side of the screen (assumption that the layout is landscape). The GridView will contain the photos currently on the SD card, and when selected, the exif tags will be extracted and, if there is GPS information, that will be targeted on the Map View.

I’m currently using inazaruk’s Map Fragment Example to display the map fragment.

I am extending Fragment and implementing LoaderManager.Callbacks within my grid fragment class. However, the “getLoaderManager().initLoader” method displays an error – saying that the PhotoGridFragment class is not applicable.

The current code for the PhotoGridFragment is:

public class PhotoGridFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {

// member variables for
private static final int PHOTO_LIST_LOADER = 0x01;
private SimpleCursorAdapter adapter;
private CursorLoader cursorLoader;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getLoaderManager().initLoader(PHOTO_LIST_LOADER, null, this);
    adapter = new SimpleCursorAdapter(
            getActivity().getApplicationContext(), R.layout.grid_item,
            null, new String[] { MediaStore.Images.Thumbnails.IMAGE_ID }, null,
            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
}

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



// Loader manager methods
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] projection = { MediaStore.Images.Thumbnails._ID };
    CursorLoader cursorLoader = new CursorLoader(getActivity(),
            MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, projection,
            null, null, null);
    return cursorLoader;
}

public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    adapter.swapCursor(cursor);
}

public void onLoaderReset(Loader<Cursor> cursor) {
    adapter.swapCursor(null);
}

I clearly am going wrong somewhere with the initialisation of the Fragment, but I’m not entirely sure where. Can edit to give code for the rest of the application if need be.

Basically I want to know: why doesn’t this code work? And is my method for retrieving images from the SD card correct? Or is that wrong as well?

  • 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-05-28T06:33:38+00:00Added an answer on May 28, 2026 at 6:33 am

    This was solved. I was using the compatibility fragment classes (android.support.v4.app.Fragment, for example). The “initLoader” method does not take a compatibility fragment as a parameter. After changing to android.app.Fragment, this issue was solved.

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

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace

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.