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

  • Home
  • SEARCH
  • 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 8040691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:58:51+00:00 2026-06-05T03:58:51+00:00

I am fetching the two column data from the database into the String Array

  • 0

I am fetching the two column data from the database into the String Array and the Int Array. And i try to show the data over the Text view. But it is not shown and given some errors. The data coming in the arrays but not shown.

My code is below

     try
        {
            mydatabase=this.openOrCreateDatabase("testdata", MODE_PRIVATE, null);

            Cursor c=mydatabase.rawQuery("SELECT DISTINCT name,MAX(user_score) AS max_score  FROM "+TableName+" WHERE user_score IS NOT NULL GROUP BY name  ORDER BY max_score DESC LIMIT 3" , null);
            int column1=c.getColumnIndex("name");
            int column2=c.getColumnIndex("max_score");
            c.moveToFirst();
            if(c!=null)
            {   int i=0;
                do
                //for(int i=0;c.moveToNext();i++)
                {
                    String Name=c.getString(column1);
                    int Score=c.getInt(column2);
                    Data[i]=Name;
                    Data1[i]=Score;
                    /*Data[1]=Name;
                    Data1[1]=Score;*/

                    System.out.println("i:"+i+"Data[i]:"+Data[i]+"Data1[i]:"+Data1[i]);

                    System.out.println("name"+Name+" score"+Score);
                    i++;
                }while(c.moveToNext());
                TextView tv=(TextView)findViewById(R.id.tv);
                TextView points=(TextView)findViewById(R.id.points);
                TextView tv1=(TextView)findViewById(R.id.tv1);
                TextView points1=(TextView)findViewById(R.id.points1);
                tv.setText(Data[0]);
                points.setText(Data1[0]);
                tv1.setText(Data[1]);
                points1.setText(Data1[1]);
                setContentView(main);
}

My Logcat is:

 06-04 13:40:35.761: E/ERROR(1347): android.content.res.Resources$NotFoundException: String resource ID #0x9a
06-04 13:40:35.761: E/ERROR(1347):  at android.content.res.Resources.getText(Resources.java:201)
06-04 13:40:35.761: E/ERROR(1347):  at android.widget.TextView.setText(TextView.java:2817)
06-04 13:40:35.761: E/ERROR(1347):  at com.k_trivia_cricket.com.high_score.onCreate(high_score.java:76)
06-04 13:40:35.761: E/ERROR(1347):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-04 13:40:35.761: E/ERROR(1347):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-04 13:40:35.761: E/ERROR(1347):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-04 13:40:35.761: E/ERROR(1347):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-04 13:40:35.761: E/ERROR(1347):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-04 13:40:35.761: E/ERROR(1347):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-04 13:40:35.761: E/ERROR(1347):  at android.os.Looper.loop(Looper.java:123)
06-04 13:40:35.761: E/ERROR(1347):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-04 13:40:35.761: E/ERROR(1347):  at java.lang.reflect.Method.invokeNative(Native Method)
06-04 13:40:35.761: E/ERROR(1347):  at java.lang.reflect.Method.invoke(Method.java:521)
06-04 13:40:35.761: E/ERROR(1347):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-04 13:40:35.761: E/ERROR(1347):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-04 13:40:35.761: E/ERROR(1347):  at dalvik.system.NativeStart.main(Native Method)
  • 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-05T03:58:53+00:00Added an answer on June 5, 2026 at 3:58 am

    Reasons :

    you are passing the int as this function get called http://developer.android.com/reference/android/widget/TextView.html#setText(int)

    you need to pass string so show that…
    http://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence)

    Answer :

    so as i said in comment points.setText(Data1[0]+””); pass as a string not res id…

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

Sidebar

Related Questions

I have a database that have two tables. The sql query fetching data correctly.
I'm fetching data from mysql longtext field. And it can contain new lines. This
I am fetching records from MySQL database using Java (JDBC). I have tables -
When fetching content from a database using activerecord, I would like to fetch a
I'm fetching data for my grid like this SELECT Orders.CustomerID, Orders.OrderTime, OrderItems.ProductID, OrderItems.Quantity FROM
I want to compare between two dates. From both the dates, I am fetching
I have two threads: Thread 1 is fetching XML from a web service in
I'm fetching two kinds of objects in Core Data, some girls and some boys.
I have two tables tracklist and song. I am fetching all values from song
In SQL Server 2008R2 fetching data between two dates is not working. I am

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.