View a text file

bobsimoneau

Member
Licensed User
Longtime User
I am developing an application with b4a. The app creates a text file like the one attached. I would like to show the file to the user and be able to - Scoll up & down and Right & Left as needed. Sort of like viewing with Printshare or Quick office. Is it possible?
 

Attachments

  • Mortgage.zip
    9.7 KB · Views: 288

bobsimoneau

Member
Licensed User
Longtime User
No. Only vertical scrolling.

Ok, Thanks. I don't not know what editor come stock with Android. When I open the file with Quick office or Printshare it looks good. I love b4a, but guess I will have to learn Java also. I guess I could always write a second app in Java and then shell to it, or re-write this one.
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
If you just need to display (not edit) the content, you can "render" it into a webpage with formatted text, table, column... But you need to wait a little bit because webkit library will coming soon.
 
Upvote 0

bobsimoneau

Member
Licensed User
Longtime User
If you just need to display (not edit) the content, you can "render" it into a webpage with formatted text, table, column... But you need to wait a little bit because webkit library will coming soon.

That sounds like a plan. Hopefully the webkit is not too far away.
 
Upvote 0

bobsimoneau

Member
Licensed User
Longtime User
If you just need to display (not edit) the content, you can "render" it into a webpage with formatted text, table, column... But you need to wait a little bit because webkit library will coming soon.

In windows internet explorer I can just load the txt files and it looks great. Can I shell to the android web browser and do the same? If so how?
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
I think I read somewhere that Android's built-in browser is unable to open locally stored files (using its URL-address field). However, there are file-explorers such as ASTRO which is able to open local HTML-pages launching either an html-viewer or some kind of text-editor so there might be a suitable "intent" around that might do it for you.

In windows internet explorer I can just load the txt files and it looks great. Can I shell to the android web browser and do the same? If so how?
 
Upvote 0

bobsimoneau

Member
Licensed User
Longtime User
If you just need to display (not edit) the content, you can "render" it into a webpage with formatted text, table, column... But you need to wait a little bit because webkit library will coming soon.

I wrote a Java program to call the webkit. It loaded the data, but had wordwrap and not horizontal scroll like in windows browser. I wrote a pretty intensive program and never imagined displaying the data would be the hardest part. I create a txt file (see Attachment 1st post) which I can load into QuickOffice or PrintShare and it looks great. I can not expect my users to purchase either program. I guess this project is on hold until I can view text with Vertical & Horizontal scrolling. Thanks for all the help.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Have you ever considered usin a panel as parent to a Label, and show the file there? then use X,Y and slide move events to offset the panel
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
I wrote a Java program to call the webkit. It loaded the data, but had wordwrap and not horizontal scroll like in windows browser.

I think you should try these HTML codes:

B4X:
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
 </HEAD>

 <BODY>

  <TABLE [COLOR="Red"]Width="1000" Height="1000"[/COLOR]>
  <TR>
   <TD>Data will be here!</TD>
  </TR>
  </TABLE>

 </BODY>
</HTML>

Just set the width and height of table bigger then your screen resolution. I think it will work.
 
Upvote 0

bobsimoneau

Member
Licensed User
Longtime User
I wrote a Java program to call the webkit. It loaded the data, but had wordwrap and not horizontal scroll like in windows browser. I wrote a pretty intensive program and never imagined displaying the data would be the hardest part. I create a txt file (see Attachment 1st post) which I can load into QuickOffice or PrintShare and it looks great. I can not expect my users to purchase either program. I guess this project is on hold until I can view text with Vertical & Horizontal scrolling. Thanks for all the help.

Was able to get Java application to work:
package simoneau.apps.WebTest;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class WebTest extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
WebView mWebView;
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.loadUrl("file:///android_asset/Mortgage.txt");
}
}

How do I include this app with my b4a project and run it from b4a?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I guess this project is on hold until I can view text with Vertical & Horizontal scrolling.
I don't know if it does what you want but look at the main Activity in my device IDE which tweaks an EditText view with my Reflection library to provide both horizontal and vertical scrolling by the user.
 
Upvote 0

bobsimoneau

Member
Licensed User
Longtime User
I don't know if it does what you want but look at the main Activity in my device IDE which tweaks an EditText view with my Reflection library to provide both horizontal and vertical scrolling by the user.

Thanks for the help. I tried to compile your device-ide and it errors:


Compiling code. Error
Error compiling program.
Error description: Unknown member: call
Occurred on line: 154
Blib.Call("button_click", params) 'Sub button_click(who)
Word: call
 
Upvote 0
Top