How much text an EditText can display or hold in it? - java

Before some one close this due to the reason that it may have been asked earlier kindly read the following note
Note: Another question here with almost same scope of information and usage has been asked earlier but it does not contain any answer! Tried googling a lot but did not find any satisfactory answer!
My Question is about the EditText in android, how much text it can hold in it?
I write a code of server which receives a request from clients and display the history of all requests received so after 2650+ requests my app begin to not respond and finally crashes. I noticed that due to some reason very large text makes the EditText unresponsive one request contains almost 85 chars data!
Platform Nokia 6.1 with Android One 9.0 Pie

There should not be any real limit, but as you see you may run out of memory or require too much computation power.
My advice: Load the visible partof the log you want to inspect / edit.
Eclipse starts "scalability mode" when you have more than ~ 5k lines of code.
WhatsApp and Telegram only show the latest ~50 messages, but quickly load more when you scroll up a lot.
9Gag, Facebook etc. will load more posts on demand.
So you should think about something like that, or google scalable textEdit solutions. My advice would be to store the logs in separate files and load dynamically.

Related

My app got admob violation of Site Behavior: Navigation and i don't knew why?

i received a message blow from admob telling me that i have put some misguided links in my app.
i tried to look and fix the problems in the app but nothing ,i improve it a little and made sure that every link is true but it's still sanding the same message.
THE MESSAGE:
As stated in our Program policies, sites or apps displaying Google ads should provide substantial and useful information to the user. Users should be able to easily navigate through the site or app to find what products, goods, or services are promised. Examples of misguided navigation include, but are not limited to:
False claims of downloadable or streaming content Linking to content that does not exist Redirecting users to irrelevant and/or misleading webpages Text on a page unrelated to the topic and/or business model of the website.
please if someone familiar with this problem could he or she give me some hints ,i well live the link to the app if someone want to check something or could see something i didn't and thank you .
link
the answer was my Target audience and content i putted all ages on my target audience when i should have put from 13 and older i hope it fix your problems cause there is other apps that this did not work on them thank you
Navigational policy means you can not setting full screen ads between two screen navigation. If you placed full screen advertisement like Tap on button to navigate to next screen and in between any full screen ad appear that against admon policy.
Correct way.
On app launch full screen ad allow to show immediately before launch home screen. You can read full with example google doc : https://support.google.com/admob/answer/6201362?hl=en
I hope that helps!
Happy Coding :)
Sometime banner ads cover or overlap the contents of the app. I had same issue and after fixing the banner ads published my app again and issue resolved. So in my opinion check your banner ads and also check any direct link that leads to another app or webpage.
I have received this message twice. As we are not able to communicate with a human being who would explain what exactly are we violating, it took me some time, failed attempts and luck to finally 'fix' it.
In the first case, under some conditions, I was interpreting the orientation sensors incorrectly and showing the wrong data to users.
In the second case, I was linking to a completely valid web page via http URL. Replacing it with https version fixed the problem.
Hope it will help someone.

How to take a webpage's content to create a native app for it? e.i not just a webview of the website

I want to create an app for a website that I don't own, like youtube or reddit. Every time I search for help, all I keep getting is how to create a webview. I've done that but that's not what I want. I want to take the website's content and create an app with it, like create my own buttons and such. I want to convert a website into an app.
I was thinking of somehow loading the website in the background and creating activities/buttons/intents that basically do what the webpage does but I don't know how to go about that or if there's a better way.
Thank you in advance.
Please let me know if clarification is needed.
Alright i got -3 votes for some reason and it has been 12 hours since i posted this question, i'm guessing the question has been consumed by the abyss of questions by now.
I made a reddit post and got some responses:
one user:
The term you’re looking for is “web scraping“ or “site scraping”. I think that’s probably what you need to research before you’re ready to handle how to make that into an app.
That’s a good starting point and once you have the content from scraping, making the app is no different than any other app.
second user:
If the website has a public (or private) API, you can use your buttons and networking calls to their API to build your client app. You are building a "YouTube client" in this case using the YouTube API.
If they dont have an API and you don't want to display their website, what you are doing is trying to reverse engineer their website and hijack the UI which is not a good practice and may even be illegal depending on the site and terms.
third user:
#second user is right on the money, but one thing I'll like to add is, the goal is to get data off of the website so that you can use in your app. An API is one (convenient) way of doing that but others are,
RSS or similar feed content (prefer this if there website supports)
HTML scraping
The above two will require you store the data somewhere else (and possible expose an API instead) because of technical reasons: you don't have access to older entries in RSS feeds and it's atrocious to keep on scraping everytime you need to access the website data. They can be done on the client (mobile app) but are best done on a server. This means you might need to get your hands dirty writing server code but you don't have to.
/thread
I'm going to do research on website scrapping and APIs to see which route i should go.
Hopefully this helped someone else.

How to check if images in an android app are current?

I am in the middle of writing an android app while teaching myself java all at the same time and my project is a bit cumbersome for a first time app. NOTE:
I am not a newbie to programming, I know several languages with the exception of java and writing code for mobile devices. With this all said and done, I don't want to have to force my users to have to update the app every time there is a new image.
Is there a way, I am assuming there is, to check on startup if all the images are up to date and if not download the new ones to the drawable resource folder for use in the app?
I have searched and found ways to remotely fetch items but nothing specifically for updating app images. For example: Splash Screen Image, or background image etc.
Thanks for your time and apologize if this does not conform to stackoverflow form of asking a question.
Shawn Mulligan
Based on my knowledges, there is no way to do why you're asking for. Resources are static contents and there no way to modify or update them programatically.
To achieve a kind of feature that you describe, it should be through a distant server, eventually with a local cache of your images on disc, associate to a download date.
But you won't be able to use them in the exact same way that you can use drawable resources.
Also depends of what you really mean by "if images are up to date".

Getting user behavior on the Android Phone (App History, Browse History etc)

Is it possible to get the user behavior on the phone (for example Alpesh has an Android phone and he uses multiple apps, browser YouTube etc). Whatever he is doing on the phone I want to get all those things from behind (which apps he has installed, which app he opens and what he search on the phone, All these data I want to get programmatically so what all can be get in android).
For now I am aware that installed apps list can be get easily but I want to get usage history and what he do all on mobile.
This is not a code solution, but an answer to your question, so you can get start some where.
In my opinion your question title are asking about two things.
(part 1) Getting User Behavior on the Android Phone (part 2)(App History, Browse
History etc)
1- First part Getting User Behavior on the Android Phone:
There is a concept called context awareness. Short described; it is about gathering different information from the phone, like light sensor, motion sensor, sound, location or even user behavior etc. and depending on your app requirement and the gathered information:
You could send these information over cloud data store for statically usage
You could make your phone doing (behavior) different things depending on location, motion or what ever.
etc.
For context awareness it is an open area for pervasive computing research. And it is not just few lines of code to write, it is typically a complete solution depending on requirement. Example I have built a context awareness application to gather noise collected by phones from different locations for research purpose inspired from this framework, but I am pretty sure you can find other frameworks or even build your own, as I did in my case.
The mentioned framework has some examples.
2- The second part is about App History, Browse History etc.:
This is possible, but you still need to build a peace of software (App) to collect all these information (logs) from the phone. Hereafter you can make phone act on different conditions and/or again send it over a RESTful API over cloud service data store, there is no limit for it.
The problem is, there is no thing out of the box for your requirement. Even if you find frameworks you still need to research it and further work on it.
You can find different examples for your requirement, like to collect browser history, you can find SO question here:
Get browser history and search result in android
Or get list of installed application:
How to get a list of installed android applications and pick one to run
My point here is you need to solve small goals at a time and put your knowledge together at the end.
Both 1 and 2 can also be related to each other, depending on your achievement.
Conclusion
Make a goal to your project.
Define the main requirements and tasks of your project.
Research your options (Technology, Cost, Target Audience, What data I can or I should not collect, what is possible to collect, what is the limits, Privacy issues etc.).
Split your project in small assets and try to solve small problems/goals.
Finally you would be able to put the puzzles together and build your final application
but i want to get usage history and what he do all on mobile
This is not possible and shouldn't ever be possible. Each app is sandboxed by Android so apps cannot inspect what other apps are doing. Think about it, you wouldn't want apps to be able to intercept private information such as banking details.
Every app is isolated from the other ones. Unless you develop a system signed app, you will not be able to gather all that data.
What you could do is to develop your own Android Rom where you then develop your data collection the exact way you want. Then you need to distribute your rom, which is another story...

Is it possible to provoke an Android OS memory crisis?

I am told that the Android OS (>=SDK14) is able in a real lean memory situation to start extinguishing tasks without sending onDistroy()-messages. It is very interesting (app quality issue) to stress test apps in such environments.
So this is a question about extreme cases, all memory is gone and the OS starts to extinguish stopped tasks to get more memory. Is it possible to provoke such a situation, to be able to test it? Shall I write a JNI program (making hello-jni looping a calloc or something)? This to chew up all the memory to provoke this situation of poverty?
How do I best memory choke my app/the Android OS environment? Any ideas? Any tried such stress tests?
Are there any total OS memory monitors available?
Can anyone explain if the Java and JNI parts of memory are from each other isolated heaps (chunks of memory) or allocated from the same common memory by the OS? Is it possible to choke the Java apps with JNI memory allocation?
So 7 years later, updated question:
Wh I know today it is not possible to provoke a JNI-memory shut down, just appears with no warning? It is not possible to test the topic in code?
This topic is a general design issue on how to design an editor the best way.
Still there are two main questions:
There is not yet a message to the Java app that the OS intends to shut down the JNI memory part, as far as I understand.
So the app can do the shut down itself instead and be aware the JNI part is shut down. It would be just as good if the app is notified that the entire app should be closed and all the mines will disappear, but that is not done either. The app may live but the JNI memory is gone and the app has no idea it happened.
Where the main problem is not knowing, not being able to test as it just crashes when the JNI memory is gone och det anropas.
Must be very tricky technically because there is such a given solution that is missing?
Given that users who are in the middle of app work jump between apps, the app can't close down the JNI part for each jump. The best solution is still to let the app crash if the JNI part is gone and let the user restart again by pressing a second time on the app icon? It's not a pretty situation?
Also, you can't assume that JNI is gone after a few days and just restart from scratch. Because then you fill the memory with unused JNI memory allocations if this is not the case. You can't test because then it crashes.
My app is a bookkeeping accounting browser and does not edit the files, but in 2023 I intend to come up with a complete accounting program based on the browser's functions with extensions. The situation is like an Office program, but works with inbdustry standard bookkeeping accounting documents/files. It requires that this question be thought through properly once more.
All views and suggestions are welcome
Data recovery and the new regulations/restrictions for saving files in the public folders
It means that you cannot use fopen() in JNI, but must use java byte streaming of the Picker. Where you can of course save the resolver and uri and reuse it for saving. See also NDK fopen() in the common storage of Android API 31
I have solved this situation for "open the last opened file on startup" by saving a copy of the last opened file in the app's local storage as well as the name of the last opened file.
To save, you must start the Picker at least once, but if the file is opened with the picker, you can reuse the resolver and uri for the file update. While it is the last opened file, you have to start the picker for an OK.
For the browser, this is a minimal problem. But for an accounting editor, it is a central question how to update documents that are worked on for a long time, and the user very likely jumps to other apps, during the work? If the JNI part disappears, it can be devastating.
I think it can save in a temp file during the work and then have a save button for the user. A temp file that can be restored after a JNI is gone crash and the app is restarted from scratch. One can probably find a way to save where the user was last and arrange a rollback?
It's so strange that there is so much trouble just because a "We intend to discard JNI stored memory for the app" message is missing, because then you have full control. Hope it still comes.
Also here all views and suggestions are welcome

Categories

Resources