Android :: Possible To Have A Single Ui Element Instance Across Application
Jul 29, 2010It doesnt seem possible, all code I've looked at from Google applications repeats the common portions of activity display in all layout files.
View 4 RepliesIt doesnt seem possible, all code I've looked at from Google applications repeats the common portions of activity display in all layout files.
View 4 RepliesI have created a custom component and i want it to be singleton in my application and i want all actvities my application to have this custom component which is singleton.
View 2 Replies View RelatedIn the application I am working on now I came up with the following problem. I have list view which is displaying items with images in most cases it will be different image for different items (thumbnails about 60x60 pixels). So the problem is how can I handle image processing for the view. For know I have the following variants:
1. I can cache all bitmaps and when I try to display view I get bitmap from cache synchronously and display it. The problem is that 60x60=3600x4=14kb per bitmap which is waste of resources.
2. When I need to display view I can register event to some thread to decode the associated bitmap which will decode it in background and than to update gui. This sounds good for me the scrolling is still smooth because all image processing is done in background. Updating list view is bit jerky for now I am doing it view notifyDataSetChanged which is updating all visible views although I can update thumbnail for a single item.
So question one is is there better way the update single listview element than calling notifyDataSetChanged.
Before asking my doubt, let me clarify my understanding of allowTaskReparenting...
Suppose there exists a Task (say Task 1) and this task has an activity (say Activity 1) which wants to call my Activity (say Activity 2). Let my activity (activity 2) set the attribute allowTaskReparenting to true and let my activity have a specific taskAffinity(affinity1). When Activity1 calls my activity (activity2), my activity becomes part of the task1. But suppose another task (task2) is already present/created with the same taskAffinity as mine (affinity1) and an activity in that task (say activity3) tries to start my activity, my activity gets re- parented to task2.
Not sure if i was clear enough. If i were to rephrase my words...
If my activity has allowTaskReparenting set to true and an instance of my activity is already present in task1. If task2 with the same task affinity as my activity tries to start my activity, the EXISTING activity gets re-parented from task1 to task2.
My quesions:
(1) Is my understanding correct ?
(2) If I am correct then a single instance of my activity gets shifted from task1 to task2. So 2 activity objects of my activity are NOT created.
I have two activities. A and B. A starts B. Both are running in the screen and both are visible. Say now B is visible.
On a special key press, I want to bring the A to the front and make it active. The problem I am facing is when the special key is pressed, another instance of A is launched and the new instance is brought to the front.
But I want the original A to come to the front. I want to make this change in the framework layer rather than application specific by using the singleInstance theme in the launchMode in AndroidManifest file.
Please help me in this regard as this is really urgent for me. Any inputs will be really valuable for me.
I would like to reuse the exact same font-face etc... like Android uses in the PreferenceScreen
Here is a screenshot I am looking to reuse the title, and the summary style from these views.
Is there a way to prevent the user of opening more than one instance of my application?
For example: User clicks on App and opens it. The user clicks on the home button. (the app is still running in the background) The user clicks on (not the menu button, but the button above it in the homescreen), and then opens the application again. Does it open the same instance, or does it create another one? If it does create another one, how can I prevent it from creating another one, and just opening the existing instance?
As a follow on from my question on sharing state between Activities, how can I save the instance state of my Application? Since Application does not extend Activity, there is no onSaveInstanceState method to override.
NB: In advance, this is not a duplicate. Despite its name, How do I save an Android application's state? relates to Activity state
I want to add an animated GIF file as an UI element to the android UI application. Note that the GIF should be shown as animation but not static image in the UI.
View 3 Replies View RelatedI have 2 activities declared as singleTask in my application. The reason for this is, with standard mode, pressing "HOME" in one activity (say A) and launching another (say B), still shows activity A.
However, a new problem arises because of this.
A -> "HOME" -> B (Result : B, Expected Result: B) -> "BACK" -> (Result:A, Expected Result: Home Screen) Any ideas why?
I am thinking to create a static method to return a reference to the application instance. I am not sure if it is safe to assume there is only one instance of the Application in one application. Apparently, the Application class in Android SDK doesn't provide such method to return the instance reference. So I suspect there must be a reason?
View 1 Replies View RelatedI have compiled Android source code already (which I downloaded using GIT), and I am being editing the source code of an Application for testing on Emulator, each time I wanna see results I have to re-Compile the source code again using 'make' I am pretty sure that there is a way to partly-compile the image.
View 1 Replies View RelatedI have an application which has multiple activities associated with it. When the user clicks on the launcher icon I want the last used activity of the application to be shown.
What's the best way to accomplish this?
I'm developing one android application which needs to support Android OS 1.5, 1.6, and 2.0. I've three different .apk files for all three SDK. How can I upload three different .apk files on Android Market Place for single application? I would like to have all 3 versions available under one application name. is this possible? So, users with any SDK can use my application.
View 5 Replies View RelatedI have a todo list type application that stores all of the note data in a sqlite3 database. Each activity in the application needs access to the database to edit different parts of the data in real time.
Currently, I have each activity open its own DBManager object (the helper class I created to manage the database). This is causing problems though and I would like a slightly more global access solution so I don't have to keep opening/closing/creating a database.
I'm considering several options, and would like to hear pros and cons of each as well as other suggestions.
Singleton style. Have a wrapper class that returns a reference to the only database manager so any activity that needs it can use it.
Static Manager. Have the manager class be entirely static members and have it open the database on load. Easily accessible by anyone that needs it (which is everyone).
Merger between 1 and 2. I could make a database manager class that initializes the member singleton instance of the database and all of the data manipulation methods were static. Then I wouldn't even need a reference to the singleton to access the database.
How easy is it to make an application that's just a wrapper around the browser? Can the Android OS boot directly into that application so that only a certain application launches after boot. I'm building a client some custom software and I'd prefer to use one of those Archos 5 MIDs than a Linux netbook.
View 2 Replies View RelatedI'm using hierarchyviewer to look through a widget that I'm using. (TimePicker).
Now I can see that TimePicker contains id/decrement, id/increment and id/timepicker_input.
How do I get a reference to id/timepicker_input for example?
Tried my_picker.findViewWithTag("decrement"); but that returns null.
I would like to know whether there is a way to insert/inject a <string> element defined in an XML file into another <string> element, doing that just with XML.
For example I could have:
<string name="author">Francesco</string>`
and I am looking for something like:
<string name="about_application">Author: @string/author</string>`
so that getString(R.string.about_application) would result in "Author: Francesco".
I know that I could combine the two elements in Java code using String.format(string, formatArgs)like for example:
<string name="author">Francesco</string>
<string name="about_application">Author: %1$s</string>`
and then in code use
String.format(getString(R.string.about_application), getString(R.string.author))
but I would like to do it in XML directly. Can anyone suggest me a way to do it?
I'm sure there's a simple answer to this, but...Why can't I nest another view type within a View element? In my layout file I try:
CODE:...
And this gives me a ClassCastException. Why?
I have an ArrayAdapter in my activity, and when a certain event occur, I'd like to make a specific element flash, or have it highlighted in some way for a couple of seconds. Is there a way to do that?
View 11 Replies View RelatedI have a TabActivity with two tabs-activities — FirstActivity and SecondActivity.
How can I access to any element (for example, change TextView's text) on FirstActivity from SecondActivity?
I am getting a parsing error and I do not know why (I am new to programing). Because of this error, R.java disappears and I end up having more errors. Hopefully someone can help me out. Here is where the error comes from: list.xml. Code...
View 2 Replies View RelatedI dropped the following into the drawable directory in my Android 1.5 project: Code...
View 1 Replies View RelatedI'm trying to scroll my ListView (from an Activity) to a particular element in the list. I know it's position in the list. How is this possible?
View 4 Replies View RelatedI added some UI elements to the main.xml file in the reslayout folder and when I try to access them through the call, R . layout. my _ uielement, the UI element that I created is not there. Even when I add a new xml file with UI elements, it still doesn't show up in the R.layout class. I have made checked the ids on them and they have the correct format (I think): android:id="@+id/my_button". What could be the problem? Do I need to compile the code first? UPDATE: I have already tried adb kill-server then adb start-server. It doesn't seem to help. I have also tried R.id.my_uielement, it doesn't register either.
View 2 Replies View RelatedI'm loading a URL into a WebView and I'm having difficulty setting the "scale" of the web-page. Specifically, the web-page is too big (800x600) for the screen, so my thought is to use "setInitialScale(50)" to reduce the size. Here is some sample code that doesn't work (i.e. the web-page doesn't scale to 50%)
WebView wv = (WebView)findViewById(R.id.webview);
wv.loadUrl("http://www.example.com/android/symptom");
wv.setInitialScale(50);
I also tried switching the order of the function calls but I get the same result¦i.e.,
WebView wv = (WebView)findViewById(R.id.webview); wv.setInitialScale(50); wv.loadUrl("http://www.example.com/android/symptom");
As an alternative, I have tried to use the "zoomOut()" function like this:
WebView wv = (WebView)findViewById(R.id.webview);
wv.loadUrl("http://www.example.com/android/symptom"); wv.zoomOut();
This approach works for a split second, and then the image reverts to its original size.
Here is my content view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"> <WebView android:id="@+id/webview"
android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>
I want to execute one method wheneer i enter number in EditText view.But i did not change the focus of EditText.I am stay in the same EditText when i enter a new number automatically i eant to execute one function.Now my question is how we find that event that means enter a new number in EditText
View 1 Replies View RelatedI'm looking for a way to dynamically change an elements properties.
For example I want the user of my app to be able to enter a value within my program that will change android:layout_marginTop="blabla" to whatever I want. It doesn't specifically have to be that property, I want to be able to change any property of any element. Is there a way to do this?
Is there a way to lookup the line number that a given element is at in an xml file via the w3c dom api?
My use case for this is that we have 30,000+ maps in kml/xml format. I wrote a unit test that iterates over each file found on the hard drive (about 17GB worth) and tests that it is parseable by our application. When it fails I throw an exception that contains the element instance that was considered "invalid". In order for our mapping department (nobody here knows how to program) to easily track down the typo we would like to log the line number of the element that caused the exception.
Can anybody suggest a way to do this? Please note we are using the W3C dom api included in the Android 1.6 SDK.
How do I declare an Android UI element using XML?
View 1 Replies View Related