0

First, I need to make a file type called .apw so that I can make it known to mmy company that all text files I send will be sent in this type.

Also, I need to make my android app's activity to be able to read this file. All I've done is set up the Android Manifest activity. I need to know what to add or change and how to set up the layout xml and the java class file.

It won't let me put it my code so I will give the details the activity is .APWF and the Header name is View .APW Files and I have it set to portrait mode only

apw2012
  • 233
  • 3
  • 5
  • 12

2 Answers2

0

You're probably looking for intent filters.

This questions should help: Android intent filter for a particular file extension?

Community
  • 1
  • 1
Steven Schoen
  • 4,366
  • 5
  • 34
  • 65
0

If you are looking for some file management, this will definitely be handy:

package utils;

import java.io.*;
import java.nio.ByteBuffer;
import java.util.Arrays;

public class Files {

private static final String file_name = "descrambler_wordlist.txt";

public static byte[][] dictionary;
private static int dic_words = 0;
public final static int WORDS_NO = 234204;

private static ByteBuffer currentlyParsingB;

public static void parseDictionary()
{
    FileInputStream fis;
    File file = new File(file_name);
    int len = 1024 * 512; //512KB
    currentlyParsingB = ByteBuffer.allocate(24);

    //currentlyParsing = new byte[24];
    dictionary = new byte[WORDS_NO][];

    try {
        fis = new FileInputStream(file);
    } catch (FileNotFoundException e1) {
        fis = null;
        e1.printStackTrace();
    }
    byte[] b = new byte[len];
    int bread;

    try {
        fis = new FileInputStream(file);

        while((bread = fis.read(b, 0, len))!=-1)
            parseBlock(b, bread);

        fis.close();

    } catch (IOException e) {
        e.printStackTrace();
    }
}

private static void parseBlock(byte[] b, int l)
{
    byte b1;

    for(int j=0; j<l; j++)
    {
        b1 = b[j];

        if(b1==10)
        {
            dictionary[dic_words] = Arrays.copyOf(currentlyParsingB.array(), currentlyParsingB.position());
            currentlyParsingB.clear();
            //word_pos = 0;
            dic_words++;
        }
        else
        {
            currentlyParsingB.put(b1);
            //currentlyParsing[word_pos] = b1;
            //word_pos++;
        }
    }
}
}

It's old code from a dictionary parser. There's extra stuff there but I guess you can easily find what you need. :)

Jose L Ugia
  • 5,960
  • 3
  • 23
  • 26