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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:16:11+00:00 2026-05-31T14:16:11+00:00

I have created following adapter: package org.virtualbet.gui.util; import java.util.List; import org.virtualbet.R; import org.virtualbet.model.Tip; import

  • 0

I have created following adapter:

package org.virtualbet.gui.util;

import java.util.List;


import org.virtualbet.R;
import org.virtualbet.model.Tip;


import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class TipListAdapter extends ArrayAdapter<Tip> {
    private final Context context;
    private List<Tip> values;

    public TipListAdapter(Context context, int textViewResourceId, List<Tip> objects) {
        super(context, textViewResourceId, objects);
        //super(context, R.layout.rowlayout, values);
        this.context = context;
        this.values = objects;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        try {
            View v = convertView;
            if (v == null) {
                LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = inflater.inflate(R.layout.row_tip, null);
            }
            Tip tip = values.get(position);
            if (tip!=null) {
                ((TextView)v.findViewById(R.id.textviewtipid)).setText((CharSequence)tip.getTipNumber());
                ((TextView)v.findViewById(R.id.textviewtiprepresentation)).setText((CharSequence)tip.getTipRepresentation());
                ((TextView)v.findViewById(R.id.textviewtipresult)).setText((CharSequence)tip.getDetails());
                ((TextView)v.findViewById(R.id.textviewtipid)).setText((CharSequence)tip.getTipOptions());
                return v;
            }
            return null;
        } catch (Throwable t) {
            Log.e("A", t.toString());
            return null;
        }
    }


}

ListView xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
    <TextView android:text="TextView" 
    android:id="@+id/textviewtipid" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    >
    </TextView>
    <TextView android:text="TextView" 
    android:id="@+id/textviewtiprepresentation" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">
    </TextView>
     <TextView android:text="TextView" 
    android:id="@+id/textviewtipresult" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">
    </TextView>
    <TextView android:text="TextView" 
    android:id="@+id/textviewtipplayed" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">
    </TextView>

</LinearLayout>

getView method is called…all textviews change their values…and after last change (no matter which one is it) program goes into catch part???

Why? Did anyone have problems like this? I’ve read somewhere that’s a project (eclipse) issue….

Oh yes, place where I am changing model is:

package org.virtualbet.gui;

import java.util.ArrayList;
import java.util.List;

import org.virtualbet.R;
import org.virtualbet.bll.TipBLL;
import org.virtualbet.gui.util.TipListAdapter;
import org.virtualbet.model.Ticket;
import org.virtualbet.model.Tip;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class FollowTicket extends Activity {

    private static final String TAG = "FollowTicket";

    private TipBLL bll;
    private TipListAdapter tipListAdapter;
    private ListView lv;
    private List<Tip> tips;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.follow_ticket);

        bll = new TipBLL();
        tips = new ArrayList<Tip>();
        tipListAdapter = new TipListAdapter(this.getApplicationContext(), R.layout.row_tip, tips);
        lv = ((ListView)findViewById(R.id.listViewTips));
        lv.setAdapter(tipListAdapter);
        ((Button)findViewById(R.id.buttonSearchForTicket)).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                searchTicket(((EditText)findViewById(R.id.editTextSerialNumber)).getText().toString());
            }
        });
    }

    private void searchTicket (String serialNumber) {
        Log.i(TAG, "Searching ticket " + serialNumber);
        Ticket ticket = bll.getTicket(serialNumber);
        if (ticket != null){
            Log.i(TAG, "Found it!");
            tips.clear();
            for (Tip tip : ticket.getTips()) {
                Log.i(TAG, "Adding tip " + tip.getTipNumber());
                tips.add(tip);
            }
            tipListAdapter.notifyDataSetChanged();
        } else {
            Log.i(TAG, "Didn't find it!");
        }
    }

}
  • 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-31T14:16:13+00:00Added an answer on May 31, 2026 at 2:16 pm

    FIXED IT! Really stupid mistake. In my layout where I was holding list to populate I had

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" <-------------ERROR!!!!!!
        android:background="#880000"
        android:orientation="horizontal" >
    

    ………….some elements

    </LinearLayout>
    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </ListView>
    

    Where ERROR!!! is pointing it should be wrap_content because this layout pushes out ListView out of the scope and it doesn’t know that there is ListView (in runtime, while coding compiler won’t complain)……really stupid!!!

    Thanks on help anyway….

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

Sidebar

Related Questions

I have created following thing in android using android compatibility support package Basically i
In Java I have created the following class which extends ImageView to create a
I have created following rule in the .htaccess file located at the root of
I have created the following string field for indexing. <fieldType name=short_text_for_sort class=solr.StrField omitNorms=true sortMissingLast=true
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
I have created the following C library for reading an image: typedef struct {
I have created the following project structure for my new asp.net mvc project any
I have created the following vsct file xml. <?xml version=1.0 encoding=utf-8?> <CommandTable xmlns=http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable xmlns:xs=http://www.w3.org/2001/XMLSchema>
I have created the following demo: http://thedrivepartnership.com/overflow.html The scrolls expand fine in FireFox /
I have created the following database layout, and started coding the application. The more

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.