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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:38:26+00:00 2026-05-30T03:38:26+00:00

I have a small problem. My app has a database which stores lazy loaded

  • 0

I have a small problem.
My app has a database which stores lazy loaded images and Json values.
I have managed to store the values into my database,however i can’t seem to store them as

I want,they are stored into the database as here.

How can I make the entries to all start at the beginning of the database.

Bellow is my code.

    @Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    //setContentView(R.layout.main);
    placeData = new DBHelper(this);

    try {
        Images("1","http://media.rightmove.co.uk/31k/30471/29462938
                    /30471_FLE100159_IMG_00_0002_max_200x138.jpg");
        Images("2","http://media.rightmove.co.uk/3k/2265/35402969
                    /2265_9897_IMG_00_0000_max_200x138.jpg");
        Images("3","http://media.rightmove.co.uk/75k/74944/18863829
                    /74944_OSI1000044_IMG_00_0000_max_200x138.jpg");
            } catch (Exception e) {
          }
           try {
        JSONArray properties = null;
        JSONParser jParser = new JSONParser();
        JSONObject json = jParser.getJSONFromUrl(url);
        try {
            // Getting Array of Contacts
            properties = json.getJSONArray(TAG_PROPERTY);

            // looping through All Contacts
            for (int i = 0; i < properties.length(); i++) {
                JSONObject c = properties.getJSONObject(i);
                String identifier = c.getString(TAG_IDENTIFIER);
                String price = c.getString(TAG_PRICE);
                String bedrooms = c.getString(TAG_BEDROOMS);
                String address = c.getString(TAG_ADDRESS);
                String propertyType =
                                     c.getString(TAG_PROPERTYTYPE);
                id = id;
                if (properties != null) {

                    // insert to database
                    insertData(id,identifier, price, bedrooms,
                                              address,propertyType);
                }

                 }
                  } catch (Exception e) {
                 }

                 } catch (Exception e) {
              }
               }

         private void insertData(String id,String identifier, String price,
             String bedrooms,String address, String propertyType) {
    // TODO Auto-generated method stub
    SQLiteDatabase db = placeData.getWritableDatabase();
    ContentValues v = new ContentValues();
    v.put(DBHelper.C_ID, id);
    v.put(DBHelper.C_IDENTIFIER, identifier);
    v.put(DBHelper.C_PRICE, price);
    v.put(DBHelper.C_BEDROOMS, bedrooms);
    v.put(DBHelper.C_ADDRESS, address);
    v.put(DBHelper.C_PROPERTYTYPE, propertyType);
    db.insert(DBHelper.TABLE, null, v);
    db.close();
}

private void Images(String id, String url) throws ClientProtocolException,
        IOException {
    // TODO Auto-generated method stub
    DefaultHttpClient mHttpClient = new DefaultHttpClient();
    HttpGet mHttpGet = new HttpGet(url);
    HttpResponse mHttpResponse = mHttpClient.execute(mHttpGet);
    if (mHttpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
        HttpEntity entity = mHttpResponse.getEntity();

        if (entity != null) {

            // insert to database
            insert(id, EntityUtils.toByteArray(entity));
        }
    }

}

private void insert(String id, byte[] image) {
    // TODO Auto-generated method stub
    SQLiteDatabase db = placeData.getWritableDatabase();
    ContentValues v = new ContentValues();
    v.put(DBHelper.C_ID, id);
    v.put(DBHelper.C_PHOTOS, image);
    db.insert(DBHelper.TABLE, null, v);
    db.close();

}

Any help or advice will be appreciated.Thanks

  • 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-30T03:38:27+00:00Added an answer on May 30, 2026 at 3:38 am

    you don’t ‘store’ them in any order – you ‘retrieve’ them in whichever order you want.

    select * from gall
    ORDER BY image
    

    or similar

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

Sidebar

Related Questions

I have a small problem during debugging my App in VS 2010 RC when
I'm developing small FTP upload app. for mac (10.6 if it matters) Have problem
I have a small app that from the home screen has a few buttons,
I am creating an app, in which I have two small imageview (using have
I have created a small application which opens,reads and creates Excel files. The app
I have a small application which reads from a Oracle 9i database and sends
I have a small app that has a Render thread. All this thread does
I'm developing an app (basically an intranet) which has a few small sets of
have small problem, and would very much appreciate help :) I should convert byte
I have small problem with my .net 2.0 winforms application. I want to embed

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.