Android :: When Using The - Efficient Adapter - Holder Is Sometimes Null

Aug 22, 2010

I'm using a mixture of the "Efficient Adapter" and the EndlessAdapter from CommonsGuy, and sometime the holder in getView() is null.


I've put the rest of the code for both of my classes here, as it's rather large to paste inline.

Once the whole data set is loaded, scrolling up & down causes rows to disappear and re-appear too.

Android :: When Using the - Efficient Adapter - holder is sometimes null

Android :: Adding Button To Efficient Adapter Which Has Icon And Text?

Apr 19, 2010

I want to create a layout in such a way that on top edittext and button should be there in one row. The search text I enter in editext and click on search button. Then I want to display a custom list view where each row contains image and text.(As per the API demos example list14 I have tried). But when I run the application, button and edittext are being added to each row (i.e., Each row contains a image, text, editext, button.

Below is my xml file:
<FrameLayout android:layout_width="wrap_content"
android:layout_height="0dip" android:layout_weight="1"></FrameLayout>
<ImageView android:id="@+id/icon" android:layout_width="48dip"
android:layout_height="48dip" />
<TextView android:id="@+id/text" android:layout_gravity="center_vertical"
android:layout_width="0dip" android:layout_weight="1.0"
android:layout_height="wrap_content" />
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/prdsearchtb"
<TableLayout android:id="@+id/TableLayout01"
android:layout_height="wrap_content"> <TableRow>
<Button android:id="@+id/prdsrcbutton" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/btn_lbl_prd_search"
android:layout_x="2px" android:layout_y="410px"></Button>
<!-- </TableRow>
and Java File:
package org.techdata.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

* @author jayanthg
public class ProductSearch extends ListActivity {
private static class ProductSearchAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private Bitmap mIcon1; private Bitmap mIcon2;
public ProductSearchAdapter(Context context) {
mInflater = LayoutInflater.from(context);
// Icons bound to the rows.
mIcon1 = BitmapFactory.decodeResource(context.getResources(),
mIcon2 = BitmapFactory.decodeResource(context.getResources(),
} @Override public int getCount() { return DATA.length;
} @Override public Object getItem(int position) { return position;
} @Override public long getItemId(int position) { return position;
} @Override public View getView(final int position, View convertView,
ViewGroup parent) { ViewHolder holder; Button btn=null;
if (convertView == null) { convertView = mInflater.inflate(R.layout.productsearch, null);
// Creates a ViewHolder and store references to the two children
// views // we want to bind data to. holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(;
holder.icon = (ImageView) convertView.findViewById(;
} else {
// Get the ViewHolder back to get fast access to the TextView
// and the ImageView. holder = (ViewHolder) convertView.getTag();
// Bind the data efficiently with the holder.
holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2);
holder.icon.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Log.i("image", " u clicked on icon Position" + position);
} } );
holder.text.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Log.i("Text", " u clicked on text Position" + position);
} } );
btn.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Log.i("Button","U clicked on button");
} } ); return convertView;
} static class ViewHolder { TextView text; ImageView icon;
} private static final String[] DATA = ListView product_search_list;
Button srch_btn;
EditText srch_text; @Override
protected void onCreate(Bundle savedInstanceState) {
setListAdapter(new ProductSearchAdapter(this));
// setContentView(R.layout.productsearch);
// getListView().setEmptyView(findViewById(;
// srch_text = (EditText)findViewById(;
// srch_btn = (Button) findViewById(;
// srch_btn.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// callProductSearchAdapter();
// }
// });
} void callProductSearchAdapter() { setListAdapter(new ProductSearchAdapter(this));
} private void createDialog(String title, String text, final Intent i) {
if (i == null) { AlertDialog ad = new AlertDialog.Builder(this).setIcon(
R.drawable.alert_dialog_icon).setPositiveButton("Ok", null)
} } }

View 2 Replies View Related

Android :: ConverView Parameter In GetView() Of My Custom Adapter For Gallery Is Always NULL

Nov 14, 2010

I have made customAdapter (which extends BaseAdapter). I want to reuse the old views..

So I am checking:


View 4 Replies View Related

Android :: Cut Off Notifications When In Holder Except Phone Ring

Aug 29, 2010

Is there anyway to make the incredible stop notifications for new email and sms messages without stopping it from ringing? I am a new user and am used to the blackberry setup that would vibrate those notifications in the holder but still allow the phone to ring. I figure there has to be an app for this but can't find it.

View 1 Replies View Related

HTC Desire :: Holder For GPS Use While Cycling

Jun 4, 2010

I've been looking for a solution for using my Desire for GPS tracking on my mountain bike for a while now and ideally I'd like an armband holder of some sort. Problem is, all the ones I've seen are basically clear cases that advertise the fact you have an expensive phone on your arm. I don't really want a handlebar mount cos my riding gets pretty rough so is there something that isn't either of these that anyone has found?

View 15 Replies View Related

HTC EVO 4G :: Car Holder With Charger For Phone?

Jul 10, 2010

I want to use my EVO as a replacement for a TomTom GPS unit I have when I'm on road trips. Does anyone make a car holder for the EVO with an integrated car charger?

View 3 Replies View Related

HTC Desire :: Length Of Cable With Car Holder

Jun 27, 2010

I am considering buying this car holder from mobilefun:HTC Desire Car Pack..I was just wondering if anyone had this dock and was able to tell me the length of the charging cable when comfortably uncoiled (I understand that it is a coiled cable).My girlfriend's car is a Fiat 500 and the cigarette lighter is quite close to the handbrake compared to other cars and I am trying to work out whether it will be ok.

View 4 Replies View Related

HTC Hero :: Good Jogging Holder?

Mar 4, 2010

Has anyone got any experience of a good holder for the hero for jogging?

View 2 Replies View Related

Sprint HTC Hero :: Car Holder For Phone?

Feb 18, 2010

I'm looking for a car holder for my Hero that will plug into my car's lighter socket. Unfortunately windshield suction holders are not allowed in Minnesota.

Does anyone know where to find one or maybe post a link to one?

View 20 Replies View Related

Android :: More Efficient Map Overlays

Nov 2, 2009

In my app I am drawing bus routes on top of a MapView. The routes have anywhere between a dozen and a few hundred GPS coordinates that describe the route that the bus takes. The problem I'm having is that once I draw out all these lines panning/zooming the MapView is incredibly slow (even clicking the 'Back' button takes a minute to happen). I'm not sure how relevant it is, but I put in some debug code then checked the logcat output and the MapView is repeatedly calling the draw() method of the Overlay whether anything has changed or not. This is happening several times a second and is causing a massive amount of garbage collection to happen (2-3 MB every second).

View 2 Replies View Related

Android :: Efficient Matrix Library

Jun 21, 2010

Is there any efficient linear algebra library for android? I need to compute matrices of different sizes(also bigger than 4x4) and rectangular too.

View 1 Replies View Related

Android :: Efficient Map Overlays In On Google Map

Nov 24, 2010

I want to do the following and am kind of stuck on these for a few days:

1) I was trying to draw poly lines ( I have encoded polylines, but have managed to decoded those) that move when I move the map(the only solution that I found was for Geopoints to be transformed into screen co-ordinateswhich wont move if I move the map !)

2) I have used helloItemizedOverlay to add about 150 markers and it gets very very slow.any idea what to do ? I was thinking about threads(handler)

3) I was looking for some sort of a timer function that executes a given function, say, every 1 minute or so.

4) I was also looking for ways to clear the Google map from all the markers/lines etc

View 1 Replies View Related

Android :: Efficient Way To Store Images

Aug 3, 2010

My application requires that when a snapshot is taken it must store in memory and next time when I restart the phone I must get a thumbnail of that photo in list of photos and the full scale photo when I click on it.There are 2 ways I know.

1. Store images directly. Concern here is every time it has to hit directory to get image which takes some time.

2. Store all images in single xml. Concern here is XML will be too big and takes time to parse.

View 1 Replies View Related

Android :: Efficient Way To Clone JSONArray

May 26, 2009

What's the most efficient way to clone a JSONArray?

View 2 Replies View Related

Android :: More Efficient Way To Get Resource ID Of Drawable From Name

Aug 21, 2009

I have some image names stored in a database, but the images themselves are in the /res/drawable folder of the application. I need to assign these images to some views at runtime, and I'm currently doing it this way:

// public static final String DRAWABLES_PATH = ":drawable/";
int resId = getResources().getIdentifier(packageName+DRAWABLES_PATH +imageName,null,null); mButtonX.setBackgroundResource(resId); //
Is there a more efficient way to do it? Or should I be storing the images directly in the database (they are many)?

View 2 Replies View Related

Motorola Droid :: Pick Program That Launches With Car Holder?

Apr 27, 2010

Is there a way to select a different program to launch when i put my droid into the OEM car mount ? i would much rather have it launch Daily road Voyages instead of the google car app.

View 8 Replies View Related

Android :: Efficient Mapping Of Strings To Ints

Dec 29, 2009

Currently I'm using a HashMap to map the strings to int and the int values need to be frequently accessed. I'm looking for a better way to do this if possible with minimal object creation, and preferable being able to store the values as primitive ints without wrapping them with the Integer class. (Basically, the reverse of the SparseArray's int->object mapping.)

View 4 Replies View Related

Android :: Memory Efficient Image Resize

Jul 10, 2010

I am trying to reduce the size of images retrieved form the camera (so ~5-8 mega pixels) down to one a a few smaller sizes (the largest being 1024x768).It looks like the OOM happens during the createBitmap. Is there a more memory efficient way to do this? Perhaps something that doesn't require me to load the entire original into memory?

View 2 Replies View Related

Android :: String Ends With - Most Efficient Way To Manipulate

Jun 24, 2010

It happens that the user click on enter where i dont want to include it as a part of my input the string can end with 3 times so just replacing one wont do the job

My solution was:


Or just to point there without the new but i want later to dump the garbage. Or at least to dump values to the gc now ....

View 5 Replies View Related

Android :: Efficient Way Of Updating UI From Service Than Intents?

Apr 12, 2010

I currently have a Service in Android that is a sample VOIP client so it listens out for SIP messages and if it recieves one it starts up an Activity screen with UI components. Then the following SIP messages determine what the Activity is to display on the screen.
For example if its an incoming call it will display Answer or Reject or an outgoing call it will show a dialling screen. At the minute I use Intents to let the Activity know what state it should display. An example is as follows:

Intent i = new Intent();
i.putExtra("", true);
Intent x = new Intent();

So the activity will have a broadcast reciever registered for these intents and will switch its state according to the last intent it received...............

View 2 Replies View Related

HTC Hero :: Speaker Crackle - Caused By Sim Card Holder Rattle?

Oct 5, 2009

Firstly just wanted to say how useful this forum has been in keeping up to date with all the latest goings on for my HTC Hero (well, T-Mobile G2 in my case). Anyway. I'm having some problems with the speaker on my phone, the one you hold to your ear, rather than the one that plays music, loud speaker etc. I think I've found a solution, so wanted to share that with you guys, but also find out if anyone else has had a similar problem.

My phone has started crackling a lot when making calls. Other people can hear me fine, but their voice seems to crackle and fizz if it gets too loud. If I turn the volume up on my phone it gets even worse. At first I thought it was a blown speaker or something, but looking at the sim card holder, it seems to be that that's causing a rattle, it gets vibrated when the sound comes through the speaker. When I tap the back of my phone, gently!, it makes a slight rattling sound. I can eliminate the problem entirely by taking the back off the phone and firmly holding the top of the battery, thus stopping the sim card holder rattling around. However this isn't an ideal solution for everyday use!

View 13 Replies View Related

Motorola Droid :: Sports Armband / Case / Holder For Phone?

Nov 30, 2009

I'd like to replace my nike+/itouch combo with the cardio trainer/droid (GPS has to be much more accurate than a pedometer)....does anyone know of any armbands out there for the droid?

View 4 Replies View Related

Android :: Efficient Way To Draw Multiple Identical Objects?

Sep 26, 2010

I would like to make a game out of many cubes and am planning on putting it on mobile platforms and also on the web using webgl. My problem is when I make a drawelements call per cube I take a hit on the frame rate. Is there a way I can make a single draw call to opengl es to draw them? The only difference between the cubes would be position and color.

View 4 Replies View Related

Android :: Server Socket Programming In 1.5 / Most Power Efficient Way?

Dec 2, 2009

I am doing a project where I have too develop an application that listens for incoming events by a service. The device that has to listen too events is an Android phone with Android SDK 1.5 on it. Currently the services that call events only implement communication trough UDP or TCP sockets. I can solve my problem by setting up a ServerSocket, but i doubt that's the most power efficient way. This application will be running most of the time, with Wi-Fi on, and I'd like too reach an long battery duration. I've been looking for options on the internet for my question for a while but i couldn't get a real answer.What is the most efficient way too listen to incoming events? Should I make an ServerSocket? or what are my options?Are there any other implementations that are more power efficient?

View 1 Replies View Related

Android :: Efficient Way To Make Database Query Faster ?

Sep 3, 2010

In my android app i need to get 50,000 database entry(text) and compare them with a value when the activity started(in onCreate()).I am doing this with the simplest way : i get the whole table from db to a cursor.However this way is too laggy.Are there any other way to do it more effective?The app is "scrabble solver" that is why i am not using WHERE close in my query (Take the whole data annd compare it with combination of the input letters).At first i was using a big table which contains whole possible words.Now i am using 26 tables.This reduced the lag and i am making database call on a thread that solved a lot problems too.It is still little bit laggy but much better.

View 4 Replies View Related

Android :: Soft Keyboard Efficient Key Press Effect?

Oct 19, 2010

on softkeyboard, which one is better to give user a visual feedback during keypress:

1.redraw portion of button that was pressed to background canvas of main View to give pressed effect

2.each button has its own "pressed" View, and that View is set to visible (flashing) during keypress event (so no redraw needed but need more memory)

I know its trade-off between speed and memory usage, but I just want to know what you will do under this situation.

View 1 Replies View Related

Android :: Need Efficient Data Mappings Example For ListView Drill Down

Oct 12, 2010

I'm pretty new to java programming and am looking to do basic data mappings.What I want to happen is when you click an item it goes to it's subcategory.I'm not worried about switching the data when an item is clicked. I'm just not sure how to create the data set in an efficient way using Android.Eventually this will be driven by a database but I want to figure out how to use mock-data to get this working first.I'd like to be able to access it like myData['category2'] or myData['category2']['subcategory3']Should I create this in xml files and link them up or is it best to create a new class structure for it?

View 1 Replies View Related

Android :: Most Efficient Way Of Time Keeping In Game Thread?

Jan 14, 2010

What is most efficient way of keeping a check on time within a game thread? Currently I create a new Date() when the game starts and was thinking of creating another Date() within the game thread and comparing it with the first one. But with a screen refreshing at around 60fps (hence a new date object each time), I can't help thinking this is rather inefficient. What other ways are there of doing this?

View 8 Replies View Related

Motorola Droid :: Simple Visor Mount / Holder That Would Work For Phone?

Dec 31, 2009

Has anyone ran across a simple visor mount/holder that would work for the Motorola Droid? I am not looking for anything elaborate. I would want to reach up and answer the phone and use the phones speaker mode for talking or can be easily removed. Something basically like the bluetooth speakers they have for visors. I am surprised I have not been able to find one.

View 36 Replies View Related

Android : Resizing Bmp Before Setting It On Remote View Make It More Efficient?

Apr 28, 2009

Can someone know the answer tell me which is more efficient if the bmp is a big bmp? RemoteViews views

1. views.setImageVIewBitMap(, bmp)

2. bmp = BmpUtils.resizeToFitIconSize(bmp) views.setImageVIewBitMap(, bmp)

In short, will resizing the bmp before setting it on a remote view make it more efficient? Or should I just let the imageView take care the resizing? Code...

View 2 Replies View Related

Copyrights 2005-15, All rights reserved