Notepad Sample - adding more columns to listview

by Hein » Wed, 26 Jan 2011 16:24:59 GMT


Sponsored Links
 I've done the notepad tutorial on Google's Android site, but I would
like to know how to add more fields to the list, in columns. At the
moment I can add the columns no problem, but they're not aligned like
you would a normal table on the layout:

john smith
heinrich cilliers
will peck

I would like it aligned as in a html table.

Any pointers?

-- 



Re: Notepad Sample - adding more columns to listview

by Kostya Vasilyev » Wed, 26 Jan 2011 17:06:55 GMT


 Every ListView item layout is separate from those next to it - 
therefore, it positions and sizes its children without any regard for 
other list items.


Two things you can try are:

- Do not try to make a table, and use multi-line layouts instead, the 
screen is typically not wide enough to fit a proper table anyway.


- For a table-like layout, position the views within your item layout so 
that they always have the same size, regardless of the data they 
contain. This can be done by using a LinearLayout, with the children 
having zero layout_width and non-zero layout_weight values.


-- Kostya

26.01.2011 11:24, Hein :
I've done the notepad tutorial on Google's Android site, but I would like to know how to add more fields to the list, in columns. At the moment I can add the columns no problem, but they're not aligned like you would a normal table on the layout: john smith heinrich cilliers will peck I would like it aligned as in a html table. Any pointers?
-- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --


Sponsored Links


Re: Notepad Sample - adding more columns to listview

by Hein » Wed, 26 Jan 2011 19:43:02 GMT


 Thank you so much.

I am considering breaking the table up into multiple views as one see
in some other apps.

It just seems strange that there is no way to do this in android,
however I've seen it in other apps, "Iriduim Flares" for example,
which shows many numerals in columns and it's easy to read accross,
perfect for what I needed.

Thanks again for responding.




-- 



Re: Re: Notepad Sample - adding more columns to listview

by Kostya Vasilyev » Wed, 26 Jan 2011 19:51:20 GMT


 The popup in Iridium Flares looks like a TableLayout:

 http://developer.android.com/reference/android/widget/TableLayout.html 

TableLayout doesn't recycle views like ListView, and so isn't really 
suited for long scrollable lists, but it's just fine for presenting 
compact data (also useful for lining up controls within a layout).


-- Kostya

26.01.2011 14:42, Hein :
Thank you so much. I am considering breaking the table up into multiple views as one see in some other apps. It just seems strange that there is no way to do this in android, however I've seen it in other apps, "Iriduim Flares" for example, which shows many numerals in columns and it's easy to read accross, perfect for what I needed. Thanks again for responding.
Every ListView item layout is separate from those next to it - therefore, it positions and sizes its children without any regard for other list items. Two things you can try are: - Do not try to make a table, and use multi-line layouts instead, the screen is typically not wide enough to fit a proper table anyway. - For a table-like layout, position the views within your item layout so that they always have the same size, regardless of the data they contain. This can be done by using a LinearLayout, with the children having zero layout_width and non-zero layout_weight values. -- Kostya 26.01.2011 11:24, Hein :
I've done the notepad tutorial on Google's Android site, but I would like to know how to add more fields to the list, in columns. At the moment I can add the columns no problem, but they're not aligned like you would a normal table on the layout: john smith heinrich cilliers will peck I would like it aligned as in a html table. Any pointers?
-- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
-- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --



Re: Re: Notepad Sample - adding more columns to listview

by fatima mansuri » Thu, 27 Jan 2011 12:30:55 GMT


 please don't send message me

-- 



Re: Notepad Sample - adding more columns to listview

by Hein » Thu, 27 Jan 2011 14:48:11 GMT


 I thought one could not do a row click on a table, so I assumed
otherwise. Pity. Thanks again.




-- 



Other Threads

1. Bluetooth Support in Emulator

Hi All,

Just want to know whether anybody has any idea when there will be bluetooth
support for Android Emulator ? As we know, there is no current support for
Bluetooth for Emulator.

Do we have any 3rd party emulator which can be used for Bluetooth
Programming without using real phone ? Or we need to have real phone ?

Thanks
Aniruddha Navare

-- 

2. AudioRecord problem

Did any one try code of sipdroid given in [url]http://sipdroid.org/[/
url]. If yes than please help me. I have to read samples from
microphone and send it to udp socket. For this I'm using AudioRecord
class as given in RtpStreamSender.java and I have use read method to
read the samples which is given below:
public int read (byte[] audioData, int offsetInBytes, int
sizeInBytes).This method reads audio data from the audio hardware for
recording into a buffer.
Its Parameters are :
 audioData :the array to which the recorded audio data is written.
offsetInBytes: index in audioData from which the data is written
expressed in bytes.
sizeInBytes :the number of requested bytes.

It Returns:
 the number of bytes that were read or or ERROR_INVALID_OPERATION if
the object wasn't properly initialized, or ERROR_BAD_VALUE if the
parameters don't resolve to valid data and indexes. The number of
bytes will not exceed sizeInBytes.

I have written this method in my code like this :
int num;
byte[] buf = new byte[160]; num = record.read(buf, 0, 160);

The problem is that it always returns 160 (i.e. the requested byte to
be read) not less than 160 even if the data is not available. I am
getting voice sample from microphone and My sampling rate is 8000 Hz
so 8000 samples per second encoding in 16 bit so to read 160 byte it
requires at least 10 milliseconds but it send data at every 1 ms. If
it is a blocking method than it should return the value 160 after
reading 160 bytes. Why it returns maximum value even if it reads
10-20bytes ? what's the problem? please help me. Thanks in advance.
My code is like :
public void run()
{
running = true;
int frame_size = 160;
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
  try
 {
 minBuffersize= AudioRecord.getMinBufferSize(8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT);
   Log.i(TAG, "trying to capture " + String.format("%d", frameSize) +
" bytes");
   record = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT,
20000);
   record.startRecording();
   byte[] buffer = new byte[frameSize];
   while (running)
  {
     record.read(buffer, 0, frameSize);
     Log.i(TAG, "Captured " + String.format("%d", frameSize) + " bytes
of audio");
  }
 }
 catch (Exception e)
 { Log.e(TAG, "Failed to capture audio"); }
}

-- 

3. getting other ScanResults fields

4. Google MAP API and Internal GPS support

5. Calling setColorFilter on an ImageView causes it to disappear in Android 2.2+

6. Use different SoftKeyboard IME on some specific fields?

7. Default keyboard in application