Android FileBrowser v.2.0

Tutorials with advanced 'difficulty' and more Lines of Code.

Android FileBrowser v.2.0

Postby plusminus » Sat Nov 24, 2007 7:37 pm

Android FileBrowser v.2.0 (Iconified-List-Based)


What is this: We want to pimp the FileBrowser (created in a tutorial before), so it displays fancy little Icons, indicating the type of the ListEntry. i.e.: directories ( Image ), audio-files ( Image ), html/php-Files ( Image ), zip/gz/jar-packages ( Image ), ....

What this tutorial includes:
  • Browsing the FileSystem showing fancy icons for the Files/Directories
  • Defining Array in XML
  • Sending Intents to the System (Open clicked files)
See also: ListActivity - Functionality

:idea: Designed/Tested with sdk-version: m5-rc14

:idea: Read before: As we are mostly combining them :!:
  1. Building an Android FileBrowser (list-based) :!: (as we are modifying/improving that tutorial!)
  2. Iconified TextList - The making of :!:

:?: Problems/Questions: post right below...

Difficulty: 2 of 5 (+ 2 other projects done before :!: )

What it will look like:
(Mode: RELATIVE)
Images taken with SDK-Version m3 !
Image
Image


0. Copy these three files (IconifiedText.java, IconifiedTextView.java and IconifiedTextListAdapter.java) from the Iconified TextList, to the (basic) FileBrowser-Project you've had created somewhen before.

1.So not that much will be changed within this tutorial, the most important change is that icon-thing.
As we now want to display Iconified Texts our class-field this.directoryEntries has to be change:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. // from:
  2. private List<String> directoryEntries = new ArrayList<String>();
  3. // to:
  4. private List<IconifiedText> directoryEntries = new ArrayList<IconifiedText>();
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


2.As we want to produce highly generic code, we do not 'hardcode' the fileendings to our application, but we define each fileType-Category(Autio, Image, Text, ...) as an array in an XML-File, like the following:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3. <array name="fileEndingImage">
  4.         <item>.png</item>
  5.         <item>.gif</item>
  6.         <item>.jpg</item>
  7.         <item>.jpeg</item>
  8.         <item>.bmp</item>
  9.     </array>
  10. <array name="fileEndingAudio">
  11.         <item>.mp3</item>
  12.         <item>.wav</item>
  13.         <item>.ogg</item>
  14.         <item>.midi</item>
  15.     </array>
  16. <array name="fileEndingPackage">
  17.         <item>.jar</item>
  18.         <item>.zip</item>
  19.         <item>.rar</item>
  20.         <item>.gz</item>
  21.     </array>
  22. <array name="fileEndingWebText">
  23.         <item>.htm</item>
  24.         <item>.html</item>
  25.         <item>.php</item>
  26.     </array>
  27. </resources>
Parsed in 0.005 seconds, using GeSHi 1.0.8.4


Isn't that generic :lol:

3.The main change is within the 'private void fill(File[] files) {...'-method. For each File in the File[]-Array passed, we need to determine its Type(a Directory or a real File) and if it is a real File, we need to find the accurate icon for it.

The first thign of course is to clear the list of the directoryEntries (as we have browsed to another directory). We also add the Directory-Navigation-Icons, as already in Version 1.0:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 this.directoryEntries.clear();
  2.                
  3.                 // Add the "." == "current directory"
  4.                 this.directoryEntries.add(new IconifiedText(
  5.                                 getString(R.string.current_dir),
  6.                                 getResources().getDrawable(R.drawable.folder)));               
  7.                 // and the ".." == 'Up one level'
  8.                 if(this.currentDirectory.getParent() != null)
  9.                         this.directoryEntries.add(new IconifiedText(
  10.                                         getString(R.string.up_one_level),
  11.                                         getResources().getDrawable(R.drawable.uponelevel)));
  12.                
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


Now we create an Variable of the type Drawable (~Icon) that will hold the current Icon to be used as we are looping through the Array of Files that was passed as the parameter. If the currentFile is a folder we load the icon from the resources:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 Drawable currentIcon = null;
  2.                 for (File currentFile : files){
  3.                         if (currentFile.isDirectory()) {
  4.                                 currentIcon = getResources().getDrawable(R.drawable.folder);
  5.                         }else{
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


If currentFile was no Folder then it was a File :arrow: we get a Drawable from the Resources, depending on the ending of the fileName of currentFile and what we entered on our fileendings.xml.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                         }else{
  2.                                 String fileName = currentFile.getName();
  3.                                 /* Determine the Icon to be used,
  4.                                  * depending on the FileEndings defined in:
  5.                                  * res/values/fileendings.xml. */
  6.                                 if(checkEndsWithInStringArray(fileName, getResources().
  7.                                                                 getStringArray(R.array.fileEndingImage))){
  8.                                         currentIcon = getResources().getDrawable(R.drawable.image);
  9.                                 }else if(checkEndsWithInStringArray(fileName, getResources().
  10.                                                                 getStringArray(R.array.fileEndingWebText))){
  11.                                         currentIcon = getResources().getDrawable(R.drawable.webtext);
  12.                                 }else if(checkEndsWithInStringArray(fileName, getResources().
  13.                                                                 getStringArray(R.array.fileEndingPackage))){
  14.                                         currentIcon = getResources().getDrawable(R.drawable.packed);
  15.                                 }else if(checkEndsWithInStringArray(fileName, getResources().
  16.                                                                 getStringArray(R.array.fileEndingAudio))){
  17.                                         currentIcon = getResources().getDrawable(R.drawable.audio);
  18.                                 }else{
  19.                                         currentIcon = getResources().getDrawable(R.drawable.text);
  20.                                 }                              
  21.                         }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4

Lets take a short look at one of those if's:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                                 /* If fileName endsWith on of the FileEndings
  2.                                  * defined in 'fileendings.xml' we load the
  3.                                  * appropriate Drawable from the Resources */
  4.                                 if(checkEndsWithInStringArray(fileName, getResources().
  5.                                                                 getStringArray(R.array.fileEndingImage))){
  6.                                         currentIcon = getResources().getDrawable(R.drawable.image);
  7.  
  8.         //...
  9.         /** Checks whether checkItsEnd ends with
  10.          * one of the Strings from fileEndings */
  11.         private boolean checkEndsWithInStringArray(String checkItsEnd,
  12.                                         String[] fileEndings){
  13.                 for(String aEnd : fileEndings){
  14.                         if(checkItsEnd.endsWith(aEnd))
  15.                                 return true;
  16.                 }
  17.                 return false;
  18.         }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4

Having determined the correct Drawable to be displayed, we switch on our displayMode (as already in v1.0) and add a new IconifiedText to this.directoryEntries with the
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                         switch (this.displayMode) {
  2.                                 case ABSOLUTE:
  3.                                         /* On absolute Mode, we show the full path */
  4.                                         this.directoryEntries.add(new IconifiedText(currentFile
  5.                                                         .getPath(), currentIcon));
  6.                                         break;
  7.                                 case RELATIVE:
  8.                                         /* On relative Mode, we have to cut the
  9.                                          * current-path at the beginning */
  10.                                         int currentPathStringLenght = this.currentDirectory.
  11.                                                                                                         getAbsolutePath().length();
  12.                                         this.directoryEntries.add(new IconifiedText(
  13.                                                         currentFile.getAbsolutePath().
  14.                                                         substring(currentPathStringLenght),
  15.                                                         currentIcon));
  16.  
  17.                                         break;
  18.                         }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4

Having looped through all files and determined all the Drawables for them, we finally sort them (was not in v1.0) [Note: I simply made: 'public class IconifiedText implements Comparable<IconifiedText>' based on the Text (FileName here). Having sorted them, we create an IconifiedTextListAdapter to handle the IconifiedTexts being put to a ListView (better said: 'itla' is set to be the ListAdapter of our ListActivity):
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 Collections.sort(this.directoryEntries);
  2.                
  3.                 IconifiedTextListAdapter itla = new IconifiedTextListAdapter(this);
  4.                 itla.setListItems(this.directoryEntries);              
  5.                 this.setListAdapter(itla);
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


There was another little change to browseTo, which alters the Title of our Application, if we are in Relative Mode:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         private void browseTo(final File aDirectory){
  2.                 // On relative we display the full path in the title.
  3.                 if(this.displayMode == DISPLAYMODE.RELATIVE)
  4.                         this.setTitle(aDirectory.getAbsolutePath() + " :: " +
  5.                                         getString(R.string.app_name));
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


The full source:

Get IconifiedList-Files here (click)
Image Download all Resource-Files for this tutorial here: here (click)

"/src/your_package_structure/AndroidFileBrowser.java"
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package org.anddev.android.filebrowser;
  2.  
  3. import java.io.File;
  4. import java.net.URISyntaxException;
  5. import java.util.ArrayList;
  6. import java.util.Collections;
  7. import java.util.List;
  8.  
  9. import org.anddev.android.filebrowser.iconifiedlist.IconifiedText;
  10. import org.anddev.android.filebrowser.iconifiedlist.IconifiedTextListAdapter;
  11.  
  12. import android.app.AlertDialog;
  13. import android.app.ListActivity;
  14. import android.content.DialogInterface;
  15. import android.content.Intent;
  16. import android.content.DialogInterface.OnClickListener;
  17. import android.graphics.drawable.Drawable;
  18. import android.net.ContentURI;
  19. import android.os.Bundle;
  20. import android.view.View;
  21. import android.widget.ListView;
  22.  
  23. public class AndroidFileBrowser extends ListActivity {
  24.        
  25.         private enum DISPLAYMODE{ ABSOLUTE, RELATIVE; }
  26.  
  27.         private final DISPLAYMODE displayMode = DISPLAYMODE.RELATIVE;
  28.         private List<IconifiedText> directoryEntries = new ArrayList<IconifiedText>();
  29.         private File currentDirectory = new File("/");
  30.  
  31.         /** Called when the activity is first created. */
  32.         @Override
  33.         public void onCreate(Bundle icicle) {
  34.                 super.onCreate(icicle);
  35.                 browseToRoot();
  36.         }
  37.        
  38.         /**
  39.          * This function browses to the
  40.          * root-directory of the file-system.
  41.          */
  42.         private void browseToRoot() {
  43.                 browseTo(new File("/"));
  44.     }
  45.        
  46.         /**
  47.          * This function browses up one level
  48.          * according to the field: currentDirectory
  49.          */
  50.         private void upOneLevel(){
  51.                 if(this.currentDirectory.getParent() != null)
  52.                         this.browseTo(this.currentDirectory.getParentFile());
  53.         }
  54.        
  55.         private void browseTo(final File aDirectory){
  56.                 // On relative we display the full path in the title.
  57.                 if(this.displayMode == DISPLAYMODE.RELATIVE)
  58.                         this.setTitle(aDirectory.getAbsolutePath() + " :: " +
  59.                                         getString(R.string.app_name));
  60.                 if (aDirectory.isDirectory()){
  61.                         this.currentDirectory = aDirectory;
  62.                         fill(aDirectory.listFiles());
  63.                 }else{
  64.                         OnClickListener okButtonListener = new OnClickListener(){
  65.                                 // @Override
  66.                                 public void onClick(DialogInterface arg0, int arg1) {
  67.                                                 // Lets start an intent to View the file, that was clicked...
  68.                                                 AndroidFileBrowser.this.openFile(aDirectory);
  69.                                 }
  70.                         };
  71.                         OnClickListener cancelButtonListener = new OnClickListener(){
  72.                                 // @Override
  73.                                 public void onClick(DialogInterface arg0, int arg1) {
  74.                                         // Do nothing ^^
  75.                                 }
  76.                         };
  77.                         AlertDialog.show(this,"Question", R.drawable.folder, "Do you want to open that file?n"
  78.                                                                 + aDirectory.getName(),
  79.                                                                 "OK", okButtonListener,
  80.                                                                 "Cancel", cancelButtonListener, false, null);
  81.                 }
  82.         }
  83.        
  84.         private void openFile(File aFile) {
  85.                 Intent myIntent = new Intent(android.content.Intent.VIEW_ACTION,
  86.                                 Uri.parse("file://" + aFile.getAbsolutePath()));
  87.                 startActivity(myIntent);
  88.         }
  89.  
  90.         private void fill(File[] files) {
  91.                 this.directoryEntries.clear();
  92.                
  93.                 // Add the "." == "current directory"
  94.                 this.directoryEntries.add(new IconifiedText(
  95.                                 getString(R.string.current_dir),
  96.                                 getResources().getDrawable(R.drawable.folder)));               
  97.                 // and the ".." == 'Up one level'
  98.                 if(this.currentDirectory.getParent() != null)
  99.                         this.directoryEntries.add(new IconifiedText(
  100.                                         getString(R.string.up_one_level),
  101.                                         getResources().getDrawable(R.drawable.uponelevel)));
  102.                
  103.                 Drawable currentIcon = null;
  104.                 for (File currentFile : files){
  105.                         if (currentFile.isDirectory()) {
  106.                                 currentIcon = getResources().getDrawable(R.drawable.folder);
  107.                         }else{
  108.                                 String fileName = currentFile.getName();
  109.                                 /* Determine the Icon to be used,
  110.                                  * depending on the FileEndings defined in:
  111.                                  * res/values/fileendings.xml. */
  112.                                 if(checkEndsWithInStringArray(fileName, getResources().
  113.                                                                 getStringArray(R.array.fileEndingImage))){
  114.                                         currentIcon = getResources().getDrawable(R.drawable.image);
  115.                                 }else if(checkEndsWithInStringArray(fileName, getResources().
  116.                                                                 getStringArray(R.array.fileEndingWebText))){
  117.                                         currentIcon = getResources().getDrawable(R.drawable.webtext);
  118.                                 }else if(checkEndsWithInStringArray(fileName, getResources().
  119.                                                                 getStringArray(R.array.fileEndingPackage))){
  120.                                         currentIcon = getResources().getDrawable(R.drawable.packed);
  121.                                 }else if(checkEndsWithInStringArray(fileName, getResources().
  122.                                                                 getStringArray(R.array.fileEndingAudio))){
  123.                                         currentIcon = getResources().getDrawable(R.drawable.audio);
  124.                                 }else{
  125.                                         currentIcon = getResources().getDrawable(R.drawable.text);
  126.                                 }                              
  127.                         }
  128.                         switch (this.displayMode) {
  129.                                 case ABSOLUTE:
  130.                                         /* On absolute Mode, we show the full path */
  131.                                         this.directoryEntries.add(new IconifiedText(currentFile
  132.                                                         .getPath(), currentIcon));
  133.                                         break;
  134.                                 case RELATIVE:
  135.                                         /* On relative Mode, we have to cut the
  136.                                          * current-path at the beginning */
  137.                                         int currentPathStringLenght = this.currentDirectory.
  138.                                                                                                         getAbsolutePath().length();
  139.                                         this.directoryEntries.add(new IconifiedText(
  140.                                                         currentFile.getAbsolutePath().
  141.                                                         substring(currentPathStringLenght),
  142.                                                         currentIcon));
  143.  
  144.                                         break;
  145.                         }
  146.                 }
  147.                 Collections.sort(this.directoryEntries);
  148.                
  149.                 IconifiedTextListAdapter itla = new IconifiedTextListAdapter(this);
  150.                 itla.setListItems(this.directoryEntries);              
  151.                 this.setListAdapter(itla);
  152.         }
  153.  
  154.         @Override
  155.         protected void onListItemClick(ListView l, View v, int position, long id) {
  156.                 super.onListItemClick(l, v, position, id);
  157.  
  158.                 String selectedFileString = this.directoryEntries.get(position)
  159.                                 .getText();
  160.                 if (selectedFileString.equals(getString(R.string.current_dir))) {
  161.                         // Refresh
  162.                         this.browseTo(this.currentDirectory);
  163.                 } else if (selectedFileString.equals(getString(R.string.up_one_level))) {
  164.                         this.upOneLevel();
  165.                 } else {
  166.                         File clickedFile = null;
  167.                         switch (this.displayMode) {
  168.                                 case RELATIVE:
  169.                                         clickedFile = new File(this.currentDirectory
  170.                                                         .getAbsolutePath()
  171.                                                         + this.directoryEntries.get(position)
  172.                                                                         .getText());
  173.                                         break;
  174.                                 case ABSOLUTE:
  175.                                         clickedFile = new File(this.directoryEntries.get(
  176.                                                         position).getText());
  177.                                         break;
  178.                         }
  179.                         if (clickedFile != null)
  180.                                 this.browseTo(clickedFile);
  181.                 }
  182.         }
  183.  
  184.      /** Checks whether checkItsEnd ends with
  185.       * one of the Strings from fileEndings */
  186.      private boolean checkEndsWithInStringArray(String checkItsEnd,
  187.                          String[] fileEndings){
  188.           for(String aEnd : fileEndings){
  189.                if(checkItsEnd.endsWith(aEnd))
  190.                     return true;
  191.           }
  192.           return false;
  193.      }
  194. }
Parsed in 0.062 seconds, using GeSHi 1.0.8.4



Regards,
plusminus
Attachments
Android_File _Browser_2_0.zip
Android File Browser 2.0 Full Source
SDK-Version: m3 !
(107.52 KiB) Downloaded 8157 times
Last edited by plusminus on Thu Feb 21, 2008 5:18 pm, edited 3 times in total.
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Hmm. Am i doing something wrong.

Postby ice2age » Thu Dec 27, 2007 8:03 pm

Im getting 2 errors.
Bound mismatch: The generic method sort(List<T>) of type Collections is not applicable for the arguments (List<IconifiedText>). The inferred type IconifiedText is not a valid substitute for the bounded parameter <T extends Comparable<? super T>>

The method compareTo(IconifiedText) of type IconifiedText must override a superclass method
ice2age
Freshman
Freshman
 
Posts: 2
Joined: Thu Dec 27, 2007 6:17 pm

Postby plusminus » Fri Dec 28, 2007 2:44 pm

Hello ice2age,

dunno why there was the following part missing:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. // Replace:
  2.  
  3. public class IconifiedText{
  4.  
  5. // With:
  6.  
  7. public class IconifiedText implements Comparable<IconifiedText>{
Parsed in 0.036 seconds, using GeSHi 1.0.8.4

Sorry for the inconveniences...

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

That worked

Postby ice2age » Fri Dec 28, 2007 5:01 pm

Thanks plusminus. Could you tell me why i cant browse the /data folder?
Im new to the platform and i wonder why there is no /home folder like on other *nix systems.
I tought there would be one something like /home/android/ {and here Pictures, Music .... }.
Is there any universal folder for Pictures, Music?. example If there is some program that can take pictures from the camera and it stores it somwhere in its own data folder and someone else has written a progrem for picture editing how can he know where the pictures are? Thanks
ice2age
Freshman
Freshman
 
Posts: 2
Joined: Thu Dec 27, 2007 6:17 pm

Postby plusminus » Fri Dec 28, 2007 5:55 pm

Hello ice2age,

yes I'm also a bit surprised about the differences between the output of the program and what the DDMS-View shows...

You probably cannot browse the "/data/"-Folder, because the rights of the Application are not high enough to do so.

I'm not aware of any default-folders for images/music yet. (also not that familiar with Linux)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby raquibulbari » Sun Jan 27, 2008 9:43 am

Hello +-,
How are you? These tutorials are simply great
Can i use codes in this forum to my android submission?? will there be any licensing issues???
Shimugool
User avatar
raquibulbari
Developer
Developer
 
Posts: 25
Joined: Sun Dec 16, 2007 6:31 am
Location: dhaka,bangladesh

Top

Postby plusminus » Sun Jan 27, 2008 1:06 pm

raquibulbari wrote:Hello +-,
How are you? These tutorials are simply great
Can i use codes in this forum to my android submission?? will there be any licensing issues???


We want 50% of all outcomes :lol: Of course NOT :!:
The only thing you "have to do" is, when someone asks you if you know a helpful Android-Forum, you will know what to answer ;)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby raquibulbari » Sun Jan 27, 2008 3:04 pm

:D
already started to advertise your site, told 2 of my android developer friend ;)
Shimugool
User avatar
raquibulbari
Developer
Developer
 
Posts: 25
Joined: Sun Dec 16, 2007 6:31 am
Location: dhaka,bangladesh

cann't resolve R.java

Postby gvkreddyvamsi » Wed Feb 13, 2008 8:18 am

HI, application is fine. Done well.

Plz attach zip file for this application.

by
vamsi
gvkreddyvamsi
Developer
Developer
 
Posts: 43
Joined: Mon Jan 21, 2008 5:10 am
Location: INDIA

Re: cann't resolve R.java

Postby plusminus » Wed Feb 13, 2008 9:29 am

gvkreddyvamsi wrote:Plz attach zip file for this application.

Attached source to the first post :uarrow:. I hope I changed nothing since the tutorial ^^.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Katharnavas » Tue Feb 19, 2008 6:05 am

I was porting this application for M5 SDk .. Everything seemed to work except that the touch screen event (ie) directly clicking on the item of the list always makes the first item as selected and the event is generated for the first item. But it works free of error with key pad controls. Is anything im doing wrong.
Katharnavas
Senior Developer
Senior Developer
 
Posts: 100
Joined: Tue Dec 04, 2007 5:57 am
Location: India

Postby Katharnavas » Wed Feb 20, 2008 1:21 pm

Any suggestions regarding this ?
Katharnavas
Senior Developer
Senior Developer
 
Posts: 100
Joined: Tue Dec 04, 2007 5:57 am
Location: India

Postby plusminus » Wed Feb 20, 2008 7:00 pm

SDK-bug maybe.

Perhaps ask in the GoogleGroups. Good luck getting an answer ^^

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Katharnavas » Thu Feb 21, 2008 5:38 am

plusminus wrote:SDK-bug maybe.

Perhaps ask in the GoogleGroups. Good luck getting an answer ^^

Regards,
plusminus


I have a listview in my application and that all work fine only the error happens with the filebrowser and im rather confused where im going wrong. can you port this application for M5.
Katharnavas
Senior Developer
Senior Developer
 
Posts: 100
Joined: Tue Dec 04, 2007 5:57 am
Location: India

Postby plusminus » Thu Feb 21, 2008 5:08 pm

Hello Katharnavas,

just tried it myself. It seems this error happens because of the change to focusing.
If I remember right, in m3 when we clicked to a listItem, the Selection was placed before one could retrieve the sleectedItemIndex() (<-- functionname in m3).

Now I'm just using the "position"-parameter of onListItemClick(...) to make it work.

Regards,
plusminus

PS: I'll port to m5 now.
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top
Next

Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests