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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:56:08+00:00 2026-05-16T06:56:08+00:00

I have an Android activity that displays a list of log entries (using a

  • 0

I have an Android activity that displays a list of log entries (using a cursor adapter and listview). When one of the entries is touched it kicks off an intent (passed with a bundle object containing the log details as strings) to another activity. The new activity is supposed to display the details in a custom TableView xml file I created, but I can not figure out how to bind the bundle strings to the id’s defined in the TextView of the TableView.

I have included most my code below so you can see what I am trying to accomplish.

ViewEntry Class:

public class ViewEntry extends Activity{

public void onCreate(Bundle icicle)
{
  super.onCreate(icicle);
  setContentView(R.layout.view_list);
  setTitle(R.string.view_entry_title);
  TableView lv= (TableView)findViewById(R.id.viewlayout);


    Bundle extras = getIntent().getExtras();
    if (extras != null){
        String date = extras.getString(plbDbAdapter.KEY_DATE);
        String ident = extras.getString(plbDbAdapter.KEY_IDENT);
        String type  = extras.getString(plbDbAdapter.KEY_TYPE); 
        String from  = extras.getString(plbDbAdapter.KEY_FROM); 
        String to  = extras.getString(plbDbAdapter.KEY_TO); 
        String remark  = extras.getString(plbDbAdapter.KEY_REMARK); 

        String[] from = new String[] { "date_h", "ident_h", "type_h", "from_h", "to_h", "remark_h"};
        int[] to = new int[] { R.id.v_date, R.id.v_ident, R.id.v_type, R.id.v_from, R.id.v_to, R.id.v_remark };
        ArrayAdapter details = new ArrayAdapter(this, R.layout.view_list, from, to);
        setAdapter(details);

        List<HashMap<String, String>> fillList = new ArrayList<HashMap<String, String>>();
        HashMap<String, String> map = new HashMap<String, String>();
                    map.put("date_h", date);
                    map.put("ident_h", ident);
                    map.put("type_h", type);
                    map.put("from_h", from);
                    map.put("to_h", to);
                    map.put("remark_h", remark);
                    fillList.add(map);
        SimpleAdapter viewadapt = new SimpleAdapter(this, fillList, R.layout.view_list, from, to);
        lv.setAdapter(viewadapt);

    }         

}

Here is view_list.xml I am trying to bind to:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/viewlayout"
    android:stretchColumns="1">
 <TableRow>
    <TextView
        android:gravity="left"
        android:text="Date:"
        android:padding="3dip" />
    <TextView
        android:id="@+id/v_date"
        android:gravity="right"
        android:padding="3dip" />

I know what I am trying to do isn’t right but hopefully it helps illustrate my intention.

  • 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-16T06:56:09+00:00Added an answer on May 16, 2026 at 6:56 am

    I never did find out if my approach above is possible, but I went a different direction to get the intended results. The solution I ended up using was to get the specific textview id and then set the the text with a string by using the setText() method in the code. This is probably the accepted way to approach this design issue, but it would be nice to be able to bind strings to xml instead of manipulating it with code.

    I have pasted the code below for future coders reference to a solution:

    public class ViewEntry extends Activity{
    
        public void onCreate(Bundle icicle)
        {
          super.onCreate(icicle);
          setContentView(R.layout.view_list);
          setTitle(R.string.view_entry_title);
          TextView tv_date = (TextView)findViewById(R.id.tv_date);
          TextView tv_ident = (TextView)findViewById(R.id.tv_ident);
          TextView tv_type = (TextView)findViewById(R.id.tv_type);
          TextView tv_from = (TextView)findViewById(R.id.tv_from);
          TextView tv_to = (TextView)findViewById(R.id.tv_to);
          TextView tv_remark = (TextView)findViewById(R.id.tv_remark);
    
        Bundle extras = getIntent().getExtras();
        if (extras != null){
            String date = extras.getString(plbDbAdapter.KEY_DATE);
            String ident = extras.getString(plbDbAdapter.KEY_IDENT);
            String type  = extras.getString(plbDbAdapter.KEY_TYPE); 
            String from  = extras.getString(plbDbAdapter.KEY_FROM); 
            String to  = extras.getString(plbDbAdapter.KEY_TO); 
            String remark  = extras.getString(plbDbAdapter.KEY_REMARK); 
    
            tv_date.setText(date);
            tv_ident.setText(ident);
            tv_type.setText(type);
            tv_from.setText(from);
            tv_to.setText(to);
            tv_remark.setText(remark);
        }         
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android application that displays a list of names using checkboxes. I
I have an activity that extends ListView. I populate my list with the results
I have an android activity that consists of a List View and a Text
I have developed an activity that displays all the Contacts of Android phone and
I have an android activity that downloads content from the web. The activity have
So I have a very simple android activity that starts a timer when you
I have an Android activity with a list. Each item can be clicked and
I have a ListView on my Android Activity. When I scroll it, the background
I have an Activity in Android, with two elements: EditText ListView When my Activity
I am developing on Android 2.3.3 (Gingerbread) and I have this particular activity that

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.