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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:13:14+00:00 2026-06-01T10:13:14+00:00

I have developed some sms application and I can’t figure out how to solve

  • 0

I have developed some sms application and I can’t figure out how to solve this issue… in one layout I am displaying two textviews to display the number and the date of the sms… that works fine…

But now I am implementing the onListItemClick and I want that when list item is clicked the whole messages from the database should load into the new view…. How can I accomplish that…

protected void onListItemClick(ListView l, View v, int position, long id) {
        // TODO Auto-generated method stub
        super.onListItemClick(l, v, position, id);


        dba.open();

        Cursor c=dba.executeQuery("select rowid _id,* from messages where rowid="+position+";");
        Log.v(tag, "value count"+ c.getCount());
        if(c.getCount()>0)
        {
            Log.v(tag, "value count"+c.getCount());
            c.moveToPosition(position);
                Intent intent = new Intent();

                String mesage = c.getString(c.getColumnIndex("msg"));

                Log.v("Value passed to class", mesage);
                intent.putExtra(name, mesage);

            intent.setClass(this, NewInterface.class);
            startActivity(intent);


        }

    }

And here is the code of the other class to which I am passing data.

protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.messages);
        tv4 = (TextView) findViewById(R.id.tvMessages);
        Bundle bundle=getIntent().getExtras();
        if(bundle!=null)
        {
            Log.v("Value got from class", bundle.getString("name"));
            tv4.setText(bundle.getString("name"));
        }

The list view is populated via this method from database containing the phone numbers….

private void openAndQueryDatabase() {

    newDB=new DBAdapter(this);

    try {

        newDB.open();
        Cursor c = newDB.executeQuery("select distinct nm,rowid _id from messages");

        if (c != null ) {

            if  (c.moveToFirst()) 
                Log.v(tag, "Stage 1");{
                do {

                    String firstName = c.getString(c.getColumnIndex("nm"));
                    Log.v(tag, firstName);
                //  String date = c.getString(c.getColumnIndex("dt"));

                    results.add(firstName);


                }while (c.moveToNext());
                Log.v(tag, "Stage 1");
            } 
        }           
  • 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-01T10:13:16+00:00Added an answer on June 1, 2026 at 10:13 am

    On click of List item you are opening a db to fetch data based on position clicked. Instead of trying to read the whole datain your first Activity, why don’t you just pass the int position to the next Activity using Intent and then make the database query there. It would be easier and make more sense. If you still want to pass the wholde data , use a code similar to the one below (replacing your if(c.getCount>0) block):

     ArrayList<String> arrayList ;
    
                Cursor c=null;
                if(c.moveToFirst()){
                    int x= c.getCount();
                    int  y =c.getColumnIndex("msg");
                arrayList = new ArrayList<String>(x);
                    for(int a=0;a<x;a++){
    c.moveToPosition(a);                    
    arrayList.add(c.getString(y));
    
                    }
                      Intent intent = new Intent(this,NewInterface.class);
                    intent.putStringArrayListExtra("msgs",arrayList );
                startActivity(intent);
                }
    

    To get the number from one of the textViews of your clicked row of ListView:

    TextView tv1=(TextView)v.findViewbyId(R.id.number)//Replace this with id of tv displaying numbers
    String number = tv1.getText().toString();
    

    Add these lines in your onListItemClick and then use this number in your query.

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

Sidebar

Related Questions

I have developed some reusable android component which is basically a class . This
I have developed a Java application and now i want to give some simple
I have an application which requires sending sms from one user to another.On receiving
I have developed an android application in which some OK button (soft key) is
I have developed an iPhone application that was rejected. With this application I offer
I have developed some android application like Phonegap. I want to make a jar
I have developed a JSF application and I am running into some funny behavior
I have developed an Android application that performs some network activity. Inside the classes
I have developed some apps for Android, and this questions stays always: How should
I have developed application for drawing some shapes (lines mostly) , now i need

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.