Support for different screens in android - java

I tried almost everything. But I have many queries which need support for multiple screens in Android. For different screen resolutions, I read here in this article http://android-developers.blogspot.in/2011/07/new-tools-for-managing-screen-sizes.html. I tried that but how can I handle this if I have 50 different activities? And which code should I write in my java files?
I even searched on developer.android link, but same result. I'm really confused. How can I make my app compatible with all devices. I tried to make a different layout file for all resolutions but when it comes to the listview part having an Adapter class where we gave a layout link, it requires too much time to fix every java file. Can anyone suggest a solution for this? How do I manage this and what code I should write in my java files so it will check automatically?

Related

How do I run an apk on J2ME?

Whats up! I just want to ask, but how do I run an .apk file j2me. I know that this question HAS been asked, but I can't seem to find an answer. Also, i'm not asking to run j2me apps on android; there are already tons of emulators. Im asking for apks running on j2me. I also know that they are developed in different VMs. So, is there any way to do that? Also, another side note, how do i resize the screen of an apk file? Thanks!
-Apersonwithalaptop22
(Edited to be easier to be understood)
You don't. A J2ME environment wouldn't have the Android framework. You'd need to write a complete android framework in the j2me language. It's not as simple as just converting dalvik bytecode to jvm bytecode- it's actually providing every single android class in the SDK. It could be done, but it would take one person a few years to do, and some things would never work quite right. Possibly you can find a project that's tried to start that effort, although I would doubt it- android moves relatively rapidly for them to keep up, and j2me is basically dead.
As for resizing the screen of an APK file- you don't. APK files don't have a screen size. Instead the idea is to write a UI that scales.

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".

Possibly non-intrusive method to change complete android application code with a library

I'm having quite tough problem while developing a testing framework for android apps. The text got a bit long so the actual question is in bold for those that don't want to read the context.
Basically, what I'd like to achieve right now is to trace user activity while he's using the application as one of the features. There's my app that manages context data all the time and developer's app - the one being tested. My idea to do this was to get coordinates where user touched the screen along with taking a screenshot simultaneously. Then I'd use the coordinates to mark the spot on the screenshot to get the idea of what user was doing the whole time with the app. Take hints on user experience and trace crashes.
Non-system apps cannot take a screenshot for security reasons, but application itself can take a screenshot of its Activities without much trouble for non-rooted users, e.g. like here. My only hope here is to interfere with developers' code to implement the functionality of doing so while my testing app is running. Each Activity then would have to extend my overridden Activity instead of regular one, implement an interface, implement broadcast receiver etc.
I am going to write a library for developer who would like his app to be tested with my framework. I'd like it to do the job for me and be as non-intrusive as it's possible for him to use. How to achieve that the best way?
Ideal case would assume linking the library to project with maybe a small addition in manifest that'd get the job done and after just unlinking, removing that bit of xml in manifest for production.
That's an open question. I don't expect any bits of code, but some nifty Java trick, Android OS functionality or even completely other approach that'd solve my problem
I tried to be as clear as possible with the question, but that's a quite tough matter for me to describe so that could have turned out contrary. Don't hesitate to ask me for more details, to speak my mind more clearly or even rewrite the question. Thank you all very much for help!

How to take a picture of in panaroma mode?

I want to make an application that allow the user to take a picture of text either from android device Gallery or from android Camera application in a Panorama mode .But i can not find any source or tutorial to do this.How can i do this in my application? how to make an application that take picture from android camera application in a panaroma mode?
Thanks in advance.
I don't know if it's still actual for you, but hope it will be helpful for someone.
Panorama feature is already implemented in standard android camera at least since Android 4.0 (perhaps it was available in even earlier versions but I'm not sure, you can check it), so since source code is open for everyone, it might be the easiest way just to copy required functionality.
Although you can download source of apps from https://android.googlesource.com/ (you want LegacyCamera or Camera), you can't just open project of any standard app in Eclipse or other IDE. For example, LegacyCamera depends on Gallery2 and other dependences that might be hard to be resolved.
I spent several days trying to move panorama feature to separate project. You can download it from here: https://github.com/yankeppey/PanoramaSample . Several remarks:
Functional core (creating one panorama image from several ones, progress notices, etc) is on native part.
I used java code from from LegacyCamera which was used in Android 4.0-4.1, not 4.2, because it was significantly easier for me. Native part is taken from 4.2, it has only minor changes inside and almost the same JNI interfaces.
This project is just to help you move panorama feature to your own app, it's not like kind of library, don't expect clean code without bugs, it's just pretty dirty and buggy project. If I have time I'll try to make it cleaner, but there is no warranty :)

Creating a landing page similar to twitter app and others

I am wanting to make a reusable 'landing page' activity similar to like the activity when you first launch the official twitter app, facebook, or google io app, etc. Reusable is really the key here I would like for the activity to dynamically populate its gridview with the other activities in the application.
Is it possible to parse through the android manifest file to find my other activities? If so is it also possible to add my own xml attributes to the manifest file to distinguish which activities should show up in the gridview?
Or, is there some other way to find all existing activity classes in the package? Is there a way in java to look for any Class in a package that implements a particular interface?
edit: here is a screen shot as per request
Is it possible to parse through the android manifest file to find my other activities?
No, but you can iterate over your activities via PackageManager and getPackageInfo().
If so is it also possible to add my own xml attributes to the manifest file to distinguish which
activities should show up in the gridview?
You should be able to use a <meta-data> element to point to an XML resource file that contains your extra data, just like app widgets and searching do. Use loadXmlMetaData() to access the contents.
That being said, I agree with Juri -- you're using a Buick to swat a fly here. Having a reusable dashboard activity is great -- working out the details of one is on my 18,000-item to-do list. Having one that tries to dynamically populate itself seems overkill.
I guess what you want is a dashboard. For ideas on how to implement it you could look at the source code of the Google I/O android app, more specifically at the activity_home.xml.
Parsing the manifest.xml could be an idea although I'm not sure whether you're able to access it. Honestly, being on a mobile where you want to use as little resources as possible I'd suggest you to reference your items hardcoded in the xml file, just as they did it on the Google I/O app.
The reason is that you probably want to promote just the most important activities of your app, not the detail views of a list or some custom popup alert which is also registered in the manifest and would therefore be difficult to distinguish from others.
How many activities do you have to put on the dashboard? Will the user ever be able to promote inactive activities because they want them? I think you have to consider those factors as well. Otherwise, you would weight the ones you want to show up first (different ways to do this) and then let them trickle into the dashboard.
As far as how to display which where, if you're using HTML/CSS then you could use a set width and a float model. Otherwise, just iterate through the list of promoted activities. I've done both in HTML/CSS dashboards I've done. It's just according to what your parameters are.
It's relatively easy to build a list in memory and loop from 1 to 6 assigning values to each of 6 locations on screen. Making them dynamically sized could be tricky.
Looking for more info to help you out, but not sure exactly how you're having issues. Unless you have something directly patentable, I would suggest showing code and what you're struggling with ...

Categories

Resources