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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:50:36+00:00 2026-05-28T00:50:36+00:00

i am new to android programming.i looking to make a question and answer application.in

  • 0

i am new to android programming.i looking to make a question and answer application.in this application i fetch the data from the data base file as follows

public String makeatext(String My_database_table, int i) {
    SQLiteDatabase myDB = getDatabase();
    String results = new String();
     Cursor cur = null;
    try {
        String firstColumn = "questions";
                 cur = myDB.query(true, My_database_table,
                new String[] { firstColumn }, null, null, null, null, null,
                null);

        int iquestion = cur.getColumnIndex(firstColumn);
        if (cur.moveToPosition(i)) {
            results = results + cur.getString(iquestion) + "\n";

        }
        return results;

    }
    catch (Exception e) {e.printStackTrace();
        Log.e("ERROR", "ERROR in Make test file :" + e.toString());
        e.printStackTrace();
        // TODO: handle exception
    }finally{
        cur.close();    
    }
    return results;
}

and in my main activity class i am initializing random value as

 Random questions;
questions  = new Random();
int Rnumber;Rnumber=0;
Rnumber=questions.nextInt(3);

and after setting the random value i am calling the function as

String shoow = myDb.makeatext(levels, Rnumber);
now i am getting a question but .what i want is as every time user opens application i want to show random questions.how to do this any suggestions will be very good to me
thanks,
maddy

  • 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-28T00:50:36+00:00Added an answer on May 28, 2026 at 12:50 am

    move line

    questions  = new Random();
    

    to onCreate()

    and

    Rnumber=questions.nextInt(3); //Rnumber can get 0, 1, 2 values
    

    to onResume

    Do You have only 3 questions????

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

Sidebar

Related Questions

I'm completely new to Eclipse/Java/Android programming, so this might sound like a dumb question,
Firstly I am new to android and Java so this is a beginners question.
i am new to android programming. in my application if i press a backbutton
I'm new to android programming and i have a question I'm developing an alarm
I'm new on android programming and i'm working on android application and i'm stuck
Hi I'm new to Android Programming and I'm trying to make a simple program
I'm new in Android programming and I want to find how to store data
I am really new in android programming. My question is how does RatingBar actually
I am new to Android programming, and looking for some general knowledge. I am
I am new in Android Programming and I am trying to include GTalk application

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.