Generalized File Manager (File Categorizer)

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Generalized File Manager (File Categorizer)

Postby Nitinkcv » Sat Dec 08, 2007 6:11 pm

Generalized File Manager (File Categorizer)


What you learn: You will learn recursively search files and list them

:?: Problems/Questions: Write them right below...

Description:
I have modified the existing File Browser to a more generalized feel. I have taken some of the code from here and there :P . I'm using the steve osborn's files' IconifiedText, IconifiedTextListAdapter and IconifiedTextView. There are however certain issued which i'm facing. I'll be posting the issues down. The screen shots should be self-explanatory regarding the App.

Code: AllFiles.java

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.cognizant.android.PhoneContentSearch;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import android.app.ListActivity;
  7. import android.app.NotificationManager;
  8. import android.content.Intent;
  9. import android.graphics.Color;
  10. import android.os.Bundle;
  11. import android.view.View;
  12. import android.widget.ArrayAdapter;
  13. import android.widget.ListView;
  14.  
  15. public class AllFiles extends ListActivity {
  16.  
  17.         private List<String> allfiles = new ArrayList<String>();
  18.         protected static String file_type = "FILE_TYPE";
  19.         protected static String folder_type = "Folder_TYPE";
  20.         protected static int search = 0;
  21.         private int notification_id = 1;
  22.         private boolean m_shownotification = true;
  23.  
  24.         /** Called when the activity is first created. */
  25.         @Override
  26.         public void onCreate(Bundle icicle) {
  27.                 super.onCreate(icicle);
  28.  
  29.                 ArrayAdapter<String> directoryList = new ArrayAdapter<String>(this,
  30.                                 android.R.layout.simple_list_item_1, getAllFiles());
  31.                 this.setTheme(android.R.style.Theme_Dark);
  32.                 this.setTitleColor(Color.TRANSPARENT);
  33.                 this.setListAdapter(directoryList);
  34.  
  35.         }
  36.  
  37.         private List<String> getAllFiles() {
  38.  
  39.                 allfiles.clear();
  40.                 String[] fileList = getResources().getStringArray(R.array.allFileList);
  41.                 for (String filetype : fileList) {
  42.                         allfiles.add(filetype);
  43.                 }
  44.                 return allfiles;
  45.         }
  46.  
  47.         /** Called when an item is selected* */
  48.         @Override
  49.         protected void onListItemClick(ListView l, View v, int position, long id) {
  50.                 int selectionRowID = (int) this.getSelectionRowID();
  51.                 String[] param;
  52.                 String selectedFileString = this.allfiles.get(selectionRowID);
  53.                 start_stop_Notification();
  54.                 switch (selectionRowID) {
  55.  
  56.                 case 0:
  57.                         param = getResources().getStringArray(R.array.fileEndingImage);
  58.                         break;
  59.                 case 1:
  60.                         param = getResources().getStringArray(R.array.fileEndingAudio);
  61.                         break;
  62.                 case 2:
  63.                         param = getResources().getStringArray(R.array.fileEndingVideo);
  64.                         break;
  65.                 case 3:
  66.                         param = getResources().getStringArray(R.array.fileEndingApp);
  67.                         break;
  68.                 case 4:
  69.                         param = getResources().getStringArray(R.array.fileEndingWebText);
  70.                         break;
  71.                 default:
  72.                         param = getResources().getStringArray(R.array.fileEndingWebText);
  73.  
  74.                 }
  75.                 Bundle bundle = new Bundle();
  76.                 bundle.putStringArray(file_type, param);
  77.                 Intent i = new Intent(AllFiles.this, SearchAllFiles.class);
  78.                 i.putExtras(bundle);
  79.                 i.putExtra(folder_type, selectedFileString);
  80.                
  81.                 startSubActivity(i, search);
  82.                
  83.         }
  84.  
  85.         protected void start_stop_Notification() {
  86.  
  87.                 NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  88.                 if (m_shownotification) {
  89.                        
  90.                         nm.notifyWithText(notification_id,
  91.                                         getText(R.string.notification_text),
  92.                                         NotificationManager.LENGTH_LONG, null);
  93.                        
  94.                 }else{
  95.                         nm.cancel(notification_id);
  96.                 }
  97.         }
  98.  
  99.         //@Override
  100.     protected void onActivityResult(int requestCode, int resultCode,
  101.                                        String data, Bundle extras) {
  102.          super.onActivityResult(requestCode, resultCode, data, extras);
  103.          // Here We identify the subActivity we started
  104.          if(requestCode == search){
  105.               m_shownotification=false;
  106.               start_stop_Notification();
  107.          }
  108.     }
  109.  
  110. }
  111.  
Parsed in 0.044 seconds, using GeSHi 1.0.8.4


Code: SearchAllFiles.java

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.cognizant.android.PhoneContentSearch;
  2.  
  3. import java.io.File;
  4. import java.net.URISyntaxException;
  5. import java.util.ArrayList;
  6. import java.util.Arrays;
  7. import java.util.Collections;
  8. import java.util.Iterator;
  9. import java.util.List;
  10.  
  11. import android.app.AlertDialog;
  12. import android.app.ListActivity;
  13. import android.content.DialogInterface;
  14. import android.content.Intent;
  15. import android.content.DialogInterface.OnClickListener;
  16. import android.graphics.Color;
  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 SearchAllFiles extends ListActivity {
  24.  
  25.         private List<String> directoryEntries = new ArrayList<String>();
  26.         private List<IconifiedText> searchEntries = new ArrayList<IconifiedText>();
  27.         private File currentDirectory = new File("/");
  28.         private String[] search_text;
  29.         private String folder_type;
  30.        
  31.        
  32.         private boolean filter_dir = true;
  33.         private boolean disable_onlistclick=false;
  34.  
  35.         /** Called when the activity is first created. */
  36.         @Override
  37.         public void onCreate(Bundle icicle) {
  38.                 super.onCreate(icicle);
  39.  
  40.                 browseToRoot();
  41.                
  42.                 this.setTitleColor(Color.TRANSPARENT);
  43.                 this.setTheme(android.R.style.Theme_Dialog);
  44.                 Bundle bundle = getIntent().getExtras();
  45.                 if (bundle != null) {
  46.                         search_text = bundle.getStringArray(AllFiles.file_type);
  47.                         folder_type = bundle.getString(AllFiles.folder_type);
  48.                         if (search_text != null) {
  49.  
  50.                                 SearchForDirectory(search_text);
  51.                         }
  52.                 }
  53.                
  54.                 this.setResult(AllFiles.search);
  55.                 this.finishSubActivity(AllFiles.search);
  56.         }
  57.  
  58.         /**
  59.          * This function browses to the root-directory of the file-system.
  60.          */
  61.         private void browseToRoot() {
  62.                 filterFiles(new File("/"));
  63.         }
  64.  
  65.         private void browseTo(final File aDirectory) {
  66.                 if (!(aDirectory.isDirectory())) {
  67.                        
  68.                         OnClickListener okButtonListener = new OnClickListener() {
  69.                                 // @Override
  70.                                 public void onClick(DialogInterface arg0, int arg1) {
  71.                                         try {
  72.                                                 // Lets start an intent to View the file, that was
  73.                                                 // clicked...
  74.                                                 Intent myIntent = new Intent(
  75.                                                                 android.content.Intent.VIEW_ACTION,
  76.                                                                 new ContentURI("file://"
  77.                                                                                 + aDirectory.getAbsolutePath()));
  78.                                                
  79.                                                 startActivity(myIntent);
  80.                                         } catch (URISyntaxException e) {
  81.                                                 e.printStackTrace();
  82.                                         }
  83.                                 }
  84.                         };
  85.                         OnClickListener cancelButtonListener = new OnClickListener() {
  86.                                 // @Override
  87.                                 public void onClick(DialogInterface arg0, int arg1) {
  88.                                         // Do nothing
  89.                                 }
  90.                         };
  91.                         AlertDialog.show(this, "Question",
  92.                                         "Do you want to open this file?n" + aDirectory.getName(),
  93.                                         "OK", okButtonListener, "Cancel", cancelButtonListener,
  94.                                         false, null);
  95.                 }
  96.         }
  97.  
  98.         //Filter the files.
  99.         //forbidden_folders = { "/sys", "/dev", "/proc", "etc" };
  100.         private void filterFiles(final File aDir) {
  101.                 File[] filesAndDirs = aDir.listFiles();
  102.                 List<File> filesDirs = Arrays.asList(filesAndDirs);
  103.                 List<File> updatedDir = new ArrayList<File>();
  104.  
  105.                 if (filter_dir) {
  106.                         for (File file : filesDirs) {
  107.                                 if (!((file.getPath().equals("/sys"))
  108.                                                 || (file.getPath().equals("/dev"))
  109.                                                 || (file.getPath().equals("/proc")) || (file.getPath()
  110.                                                 .equals("/etc")))) {
  111.                                         updatedDir.add(file);
  112.                                 }
  113.                         }
  114.  
  115.                 }
  116.                 for (File file : updatedDir) {
  117.                         fillFiles(file);
  118.                 }
  119.         }
  120.  
  121.         //Recursive loop to populate the files.
  122.         //Not a fast method  <img src="http://www.anddev.org/images/smilies/icon_cry.gif" alt=":cry:" title="Crying or Very sad" />
  123.         private List<String> fillFiles(final File aDir) {
  124.  
  125.                 this.currentDirectory = aDir;
  126.                 int currentDirectoryLength = this.currentDirectory.getAbsolutePath()
  127.                                 .length();
  128.  
  129.                 File[] filesAndDirs = aDir.listFiles();
  130.  
  131.                 if (filesAndDirs != null) {
  132.  
  133.                         List<File> filesDirs = Arrays.asList(filesAndDirs);
  134.                         for (File file : filesDirs) {
  135.  
  136.                                 this.directoryEntries.add(file.getAbsolutePath().substring(
  137.                                                 currentDirectoryLength+1));
  138.                                 if (file.isDirectory()) {
  139.  
  140.                                         fillFiles(file);
  141.                                 }
  142.                         }
  143.                 }
  144.  
  145.                 Collections.sort(this.directoryEntries);
  146.                 return this.directoryEntries;
  147.         }
  148.  
  149.         // Search for the file type
  150.         protected void SearchForDirectory(String[] searchText) {
  151.  
  152.                 this.searchEntries.clear();
  153.                 Drawable currentIcon = null;
  154.                
  155.                 for (String filetype : searchText) {
  156.                        
  157.                         for (Iterator iterator = directoryEntries.iterator(); iterator
  158.                                         .hasNext();) {
  159.                                 String type = (String) iterator.next();
  160.                                 if (type.contains(filetype)) {
  161.                                         if (checkEndsWithInStringArray(type, getResources()
  162.                                                         .getStringArray(R.array.fileEndingImage))) {
  163.                                                 currentIcon = getResources().getDrawable(
  164.                                                                 R.drawable.image);
  165.                                         } else if (checkEndsWithInStringArray(type, getResources()
  166.                                                         .getStringArray(R.array.fileEndingWebText))) {
  167.                                                 currentIcon = getResources().getDrawable(
  168.                                                                 R.drawable.webpage);
  169.                                         } else if (checkEndsWithInStringArray(type, getResources()
  170.                                                         .getStringArray(R.array.fileEndingAudio))) {
  171.                                                 currentIcon = getResources().getDrawable(
  172.                                                                 R.drawable.audio);
  173.                                         } else if (checkEndsWithInStringArray(type, getResources()
  174.                                                         .getStringArray(R.array.fileEndingApp))) {
  175.                                                 currentIcon = getResources().getDrawable(
  176.                                                                 R.drawable.icon1);
  177.                                         } else if (checkEndsWithInStringArray(type, getResources()
  178.                                                         .getStringArray(R.array.fileEndingVideo))) {
  179.                                                 currentIcon = getResources().getDrawable(
  180.                                                                 R.drawable.video);
  181.                                         } else {
  182.                                                 currentIcon = getResources().getDrawable(
  183.                                                                 R.drawable.text);
  184.                                         }
  185.                                         searchEntries.add(new IconifiedText(type, currentIcon));
  186.                                 }
  187.                                
  188.                         }
  189.                                                
  190.                         if (!(this.searchEntries.isEmpty())) {
  191.                                
  192.                                 IconifiedTextListAdapter itla = new IconifiedTextListAdapter(
  193.                                                 this);
  194.                                 itla.setListItems(this.searchEntries);
  195.                                 this.setListAdapter(itla);
  196.                         } else {
  197.  
  198.                                
  199.                                 disable_onlistclick=true;
  200.                                 //this.setDefaultKeyMode(DISABLE_DEFAULT_KEYS);
  201.                                 currentIcon=getResources().getDrawable(R.drawable.sadsmiley);
  202.                                 String no_match="Sorry! No matches for " + folder_type;
  203.                                 this.searchEntries.add(new IconifiedText(no_match, currentIcon));
  204.                                 IconifiedTextListAdapter itlanomatch = new IconifiedTextListAdapter(
  205.                                                 this);
  206.                                 itlanomatch.setListItems(this.searchEntries);
  207.                                 this.setListAdapter(itlanomatch);
  208.                                
  209.                                
  210.                         }
  211.  
  212.                 }
  213.         }
  214.  
  215.         /**
  216.          * Checks whether checkItsEnd ends with one of the Strings from fileEndings
  217.          */
  218.         private boolean checkEndsWithInStringArray(String checkItsEnd,
  219.                         String[] fileEndings) {
  220.                 for (String aEnd : fileEndings) {
  221.                         if (checkItsEnd.endsWith(aEnd))
  222.                                 return true;
  223.                 }
  224.                 return false;
  225.         }
  226.        
  227.        
  228.         @Override
  229.         protected void onListItemClick(ListView l, View v, int position, long id) {
  230.                 int selectionRowID = (int) this.getSelectionRowID();
  231.  
  232.                 File clickedFile = new File(this.currentDirectory.getAbsolutePath()+this.directoryEntries.get(selectionRowID));
  233.  
  234.                 if (clickedFile != null && !disable_onlistclick){
  235.                         this.browseTo(clickedFile);
  236.                 }
  237.                
  238.         }
  239. }
  240.  
Parsed in 0.059 seconds, using GeSHi 1.0.8.4


code:allfiles.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3.         <array name="allFileList">
  4.         <item>Pictures</item>
  5.         <item>Sounds</item>
  6.         <item>Videos</item>
  7.         <item>Android Applications</item>
  8.         <item>Saved Web Pages</item>
  9.         <item>Others</item>
  10.     </array>
  11. </resources>
  12.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


code:fileendings.xml

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. <array name="fileEndingVideo">
  28.         <item>.avi</item>
  29.         <item>.flv</item>
  30.         <item>.wav</item>
  31.     </array>
  32. <array name="fileEndingApp">
  33.         <item>.apk</item>
  34.     </array>        
  35. </resources>
  36.  
Parsed in 0.008 seconds, using GeSHi 1.0.8.4


O.K. now i come to the issues that i'm facing.
1)As seen in the androidapp2.PNG im doing a sort of a wait message using the notification manager (not sure if i'm using it coreectly :?: ). The very first time run the app and click one of the list items the 'Please Wait' message pops up and fades away to show the searchresults page. However when i come back to my app by pressing the back button and then click the list item, the 'Please Wait...' message doesnt show up. i know theres something wrong in the code(Lifecycle of the activity) coz on debugging i found out some irregularities.

2)Is there any way to display an image or icon in that status bar which displays the 'Please wait...' message??

3)How can i attach an image inline with the code :?:

I also welcome any suggestions on improving the app.

Thanks,
Nitin
Attachments
androidapp.PNG
Screen1
androidapp.PNG (9.61 KiB) Viewed 9837 times
androidapp2.PNG
On clicking the list item
androidapp2.PNG (11.07 KiB) Viewed 9837 times
androidapp3.PNG
The search results screen
androidapp3.PNG (14.29 KiB) Viewed 9837 times
Last edited by Nitinkcv on Sun Dec 09, 2007 9:14 am, edited 1 time in total.
Nitinkcv
Developer
Developer
 
Posts: 29
Joined: Thu Nov 29, 2007 1:02 pm

Top

Postby living_sword » Sat Dec 08, 2007 7:12 pm

you can use indeterminate progress bar to show the Wait message.
living_sword
Junior Developer
Junior Developer
 
Posts: 23
Joined: Fri Nov 23, 2007 4:44 am

Postby plusminus » Sat Dec 08, 2007 10:16 pm

Hello Nitinkcv,

Your app categorizes all files right :?: Would you please alter the topic-title, so users can see from outside, what is in here ? :)

as living_sword said, a progress bar with an indeterminate end is what you probably searching for.
Google itself provides 4 examples on that: (click) and scroll down to ProgressBar.

A Notification lasts only for a couple of seconds, a progress-bar as long as you want it to (not tested, but would be logical). The Progress bar already brings a nice animated image with it :)

What do you mean with (I don't understand it :( ):
3)How can i attach an image inline with the code


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

ProgressDialog

Postby Nitinkcv » Sun Dec 09, 2007 9:19 am

Hi,

i went through the Progress Bar topic(ProgressDialog class). The problem which i have is that im able to set the indeterministic mode of the progress bar. But im not sure how to cancel the entire progressdialog when the search page loads up.

Currently its in the onActivityResult method that i'm setting my boolean variable false
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. protected void onActivityResult(int requestCode, int resultCode,
  3.  
  4.                                        String data, Bundle extras) {
  5.  
  6.          super.onActivityResult(requestCode, resultCode, data, extras);
  7.  
  8.          // Here We identify the subActivity we started
  9.  
  10.          if(requestCode == search){
  11.  
  12.               m_shownotification=false;
  13.  
  14.               start_stop_Notification();
  15.  
  16.          }
  17.  
  18.     }
  19.  
  20.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


Again the prob is that only when i hit the back button that this is fired and then too the ProgressBar dialog doesnt stop.

Regarding my last query.. i just wanted to know while posting how could i place the IMAGES inline with my query :D .
Currently im setting it as an attachment.

And yes i belive the app categorizes every file. However the Others section should be removed i feel.
Thanks,
Nitin
Nitinkcv
Developer
Developer
 
Posts: 29
Joined: Thu Nov 29, 2007 1:02 pm

Postby plusminus » Sun Dec 09, 2007 4:13 pm

Hello

The call to finishSubActivity(...) in onCreate(...) of SearchAllFiles.java is not neccesary ( or did you want to close the SearchAllfiles-Activity, right when it founf all files ;) )

This is how I solved it:
The 'outer' Activity starts the Notification and the Inner(Worker)-Activity will cancel it , when it is finished, using the public notification_id in the 'outer' class.

I did it like the following:
In your AllFiles.java:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.      public static final int notification_id = 0x1337;
  2.      //...
  3.      //...
  4.      protected void start_Notification() {
  5.          NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  6.  
  7.          nm.notifyWithText(notification_id,
  8.                          getText(R.string.notification_text),
  9.                          NotificationManager.LENGTH_LONG, null);
  10.  
  11.      }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


In your SearchAllFiles.java :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.      /** Called when the activity is first created. */
  2.      @Override
  3.      public void onCreate(Bundle icicle) {
  4.           super.onCreate(icicle);
  5.  
  6.           browseToRoot();
  7.          
  8.           this.setTitleColor(Color.TRANSPARENT);
  9.           this.setTheme(android.R.style.Theme_Dialog);
  10.           Bundle bundle = getIntent().getExtras();
  11.           if (bundle != null) {
  12.                search_text = bundle.getStringArray(FileCategorizer.file_type);
  13.                folder_type = bundle.getString(FileCategorizer.folder_type);
  14.                if (search_text != null) {
  15.                     SearchForDirectory(search_text);
  16.                }
  17.           }
  18.           stop_Notification();
  19.      }
  20.      
  21.      protected void stop_Notification() {
  22.          NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  23.          nm.cancel(FileCategorizer.notification_id);
  24.      }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


Posting images "inline" is only possible, when you uploaded them somewhere before (your webspace, or any free image-hoster) but not preferable, because you cannot be sure, how long they will last there ^^.

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

Thanks a lot!!

Postby Nitinkcv » Sat Dec 15, 2007 8:52 am

Hi plusMinus,

Sorry for the late response. Was really stuck up with work. Your method worked brilliantly. Thanks a lot :D
Nitinkcv
Developer
Developer
 
Posts: 29
Joined: Thu Nov 29, 2007 1:02 pm

Top

Postby Katharnavas » Thu Dec 20, 2007 8:56 am

Hi,
Every thing is fine in listing part .. Does we need to modify anything in the AndroidManifest.xml file. It seems to be.. Did you forget anything to post related to that.
Katharnavas
Senior Developer
Senior Developer
 
Posts: 100
Joined: Tue Dec 04, 2007 5:57 am
Location: India

Postby Nitinkcv » Thu Dec 20, 2007 2:39 pm

Hi,

It would be great if you could tell me what is the exact error that you are getting.
Thanx

Nitin
Nitinkcv
Developer
Developer
 
Posts: 29
Joined: Thu Nov 29, 2007 1:02 pm

Postby Katharnavas » Mon Dec 24, 2007 8:00 am

Hi,
I have attached the screen shot of the error message. Take a look.
Nitinkcv wrote:Hi,

It would be great if you could tell me what is the exact error that you are getting.
Thanx

Nitin
shot
Attachments
error.png
ERROR MESSAGE
error.png (14.12 KiB) Viewed 9160 times
Katharnavas
Senior Developer
Senior Developer
 
Posts: 100
Joined: Tue Dec 04, 2007 5:57 am
Location: India

Postby plusminus » Mon Dec 24, 2007 2:33 pm

Hello Katharnavas,

exactly the "SubActivity" has to be defined in the AndroidManifest.xml like the following:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.    package="org.anddev.android.subactivitywithresult">
  4.     <application android:icon="@drawable/icon">
  5.         <activity class=".MainActivity" android:label="@string/main_app_name">
  6.             <intent-filter>
  7.                 <action android:value="android.intent.action.MAIN" />
  8.                 <category android:value="android.intent.category.LAUNCHER" />
  9.             </intent-filter>
  10.         </activity>
  11.         <activity class=".YOURSubActivityCLASSNAME" android:label="@string/sub_app_name">
  12.             <intent-filter>
  13.                 <action android:value="android.intent.action.VIEW" />
  14.                 <category android:value="android.intent.category.DEFAULT" />
  15.             </intent-filter>
  16.         </activity>
  17.     </application>
  18. </manifest>
Parsed in 0.004 seconds, using GeSHi 1.0.8.4

Example was taken from :src: this tutorial, have a look there. :)

Merry Christmas,
plusminus :xmas:
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 Dec 25, 2007 7:36 am

:xmas: Merry XMas

Hi,
Thanks for your suggestions.. It worked for me..
Katharnavas
Senior Developer
Senior Developer
 
Posts: 100
Joined: Tue Dec 04, 2007 5:57 am
Location: India

Postby rmeph » Fri Jan 04, 2008 2:14 pm

in code where used "R.array.fileEndingImage"
error show "R.array cannot resolved"
allfiles.xml and fileendings.xml write in res->layout folder but in R.java cannot show array fileld
how to solved it??????????? :cry:
Attachments
untitled.PNG
resfolder
untitled.PNG (31.86 KiB) Viewed 8741 times
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

R.java

Postby Nitinkcv » Fri Jan 04, 2008 2:59 pm

Hi,

i think there is some problem with your R.java file.. It seems its not generating properly.

I had taken the example from here

Also there seems to be an error in your manifest.xml.. Just right click your package and choose 'Android Tools' and select 'Fix project properties'.. That could help i hope.

Also try looking here for R.java problems

Thanx,
Nitin
Nitinkcv
Developer
Developer
 
Posts: 29
Joined: Thu Nov 29, 2007 1:02 pm

Postby rmeph » Fri Jan 04, 2008 3:31 pm

Thanks for help.. It's working.. :D
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby Nitinkcv » Fri Jan 04, 2008 4:11 pm

You are welcome :D

Which one helped you.. Fixing the project property or the other one or neither of them :) ..
Nitinkcv
Developer
Developer
 
Posts: 29
Joined: Thu Nov 29, 2007 1:02 pm

Top
Next

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests