One adapter for different adapter views - how to specify proper layout for the view?

by (Mishail) » Wed, 04 Mar 2009 23:50:13 GMT


Sponsored Links
 Greetings,

I want to re-use 1 adapter (similar to well known ImageAdapter from
samples) with 2 different views - Gallery and GridView.

I need to specify LayoutParams for the each View returned by getView()
method of my adapter. In case of Gallery it should be instance of
Gallery.LayoutParams, and in case of GridView it should be
GridView.LayoutParams. I'll get an exception for sure if I'll try
Gallery.LayoutParams with GridView and vice versa.

What is the best way to do that? Can I somehow use "parent" parameter
(ViewGroup parent) for that?

--~--~---------~--~----~------------~-------~--~----~



One adapter for different adapter views - how to specify proper layout for the view?

by (Mishail) » Thu, 05 Mar 2009 20:59:07 GMT


 Up thread.

I believe it should be trivial. Just stick my nose into the
appropriate docs
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. java.io.FileNotFoundException: (Device or resource busy)

On the 3.0 honeycomb, I am getting this error when trying to access a
file. It does not happen all the time. What causes is that I browse
around the market a bit and then i come back to my app. It tries to
access a file, and i get this error:

Exception caught in com.app.android.activities.Preview$DLTask: /mnt/
sdcard/tmp/1304702202502.jpg (Device or resource busy)
java.io.FileNotFoundException: /mnt/sdcard/tmp/1304702202502.jpg
(Device or resource busy)
at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:
239)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at java.io.FileOutputStream.<init>(FileOutputStream.java:77)
at com.app.android.activities.Preview
$DLTask.doInBackground(Preview.java:200)
at com.app.android.activities.Preview
$DLTask.doInBackground(Preview.java:1)
at com.app.android.activities.appAsyncTask$2.call(appAsyncTask.java:
176)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1081)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:574)
at java.lang.Thread.run(Thread.java:1020)


To get the same code working again after I restart the device, i.e.
power off/on.

The same code works fine on the android version 7, but at times it
crashes on v11.

-- 

2. Bluetooth external touchpad interaction

Folks,

This one is for someone who has played around with Bluetooth devices a bit, 
which I haven't. I have a simple swipe(fling)-tap interaction demo app that 
works  perfectly on the device (DroidX). I am attempting to "drive" it with 
a Bluetooth connected touchpad. The Bluetooth touchpad connects fine and 
mimics the Droid touchpad for the home screen and apps just fine but will 
not interact with my demo app. Am I making a naive assumption that once the 
Bluetooth touchpad connection/interaction is established it should be 
universal across all apps (which it appears to, except mine) or am I missing 
something fundimental in enableing it in the app. I am not using the app to 
connect to the Bluetooth touchpad, it is established and working before the 
app comes up.

I have scoured the docs but to no avail.

Thanks, Steve

-- 

3. Android Build dont work on Nexus S

4. Multiple Layout within an expandable list

5. Enable/Disable Broadcastreceiver from widget

6. Gyroscope heading change affects y axis

7. How to define mp3 file in manifest?