Android : Multiple Instances Of Included Layout - Namespacing

Jan 12, 2010

I've been attempting to use the <include> tag in some layouts and it seems that these are of limited use because of the flat namespace of the R.id.x approach.

Suppose I have a layout (attribs and xml namespace decl omitted for clarity).

CODE:.......

Now in my java code I have a conundrum. I am not able to identify each individual instance o f the children included layouts root view. In the include tags I can replace the root id with "row1" and "row2" so I can find the individual linear layouts using findViewById

eg:

CODE:.........

However, I can't easily access the two instances of the TextView which are children of row1 and row2 because all I have to play with is the single id "text"

ie:

CODE:..........

In this case, which instance (row1.text or row2.text) does this refer to, both of them, or none?

I guess I would need to use another means of accessing the children of row1 and row2.

Android : Multiple instances of included layout - namespacing


Android :: Starting Activity With FLAG ACTIVITY MULTIPLE TASK To See Multiple Instances

Feb 2, 2009

I am trying to launch an activity from another activity .. Within the com.android.SingleLauncher..

I have activity launch code as ..

CODE:...........

I have set the android:multiprocess="true" in the AndroidManifest.xml of TargetSL I don't seem to see the multiple instances of TargetSL, which i am expecting ..

All i see is 2 process, where i was hoping to see an instance of TargetSL, for each launch that was invoked by the singleLauncher!

View 3 Replies View Related

Android : How To Run Multiple Instances Of Same App?

Sep 14, 2010

is it possible to run multiple instances of the same app on android? What I mean if the app does not support multiple identities is it possible to install it twice and configure each instance separately?

View 1 Replies View Related

Android :: Multiple Instances Of Service?

Apr 15, 2010

I would like to do this, let me know if it possible in android?

App1 --> bindService() or startService() to AndroidService1 App2 --> bindService() or startService() to AndroidService1 (same service)

I would like App1 and App2 to get different instances of AndroidService1. Why I want to do this is say App2 doesn't need the service any more & it calls stopService() then App1 should still continue to work with its own instance of service app.

View 2 Replies View Related

Android :: How To Create Multiple Instances Of An Activity

Feb 19, 2010

I want to create multiple instances of an activity in the same process. Should I use FLAG_ACTIVITY_NEW_TASK flag like the code below?

CODE:...............

This code is executed in class A to create another instance of activity A.

This question, will this code create another task? As I understand is a process can only have one task. Does it mean the two activities will exist in different tasks? That's what I want. I want the two activities to be in the same process.

View 1 Replies View Related

Android : How To Create Multiple Instances Of An Activity?

Jul 1, 2010

I was wondering is it possible to create multiple instances of a single Activity in Android?

I currently start my own inCall screen for a Voip Test by using the following code...

This allows me to start the Activity fine. However when I call it for a second it just returns to the Activity already created rather than creating a new Activity and placing it on the stack.

I would like to be able to create the activity multiple times so that I have two or 3 Activities on the stack and the user can switch between them, using Home, Back buttons etc... Is this possible and if so what am I doing wrong?

View 1 Replies View Related

Android :: Access Items In An Included Layout?

May 11, 2009

Let's say I have a list of included layouts and I want to access the widgets in the included layouts...how do I do that? code...

View 3 Replies View Related

General :: Possible To Run Multiple Instances Of Same APK?

May 13, 2014

I'm wanting to install 2 instances of the same APK.The app is: Star Wars Force Collection..Once you install the app and login to your account, theres no way to change accounts without uninstalling / reinstalling and logging into new account.

View 4 Replies View Related

Android :: Can I Save SharedPreferences To File So I Can Have Multiple Instances Of The Prefs?

Jul 19, 2010

I love how SharedPreferences work in android and I would like to know if there is an easy way to save them to another file so I could load a previous instance of the prefs and vice versa. Basically when you load this file, all the preferences would change to how you had it before at once. I want to be able to swap 3 or 4 different versions of the same pref keys in this way. Is there an easy way to do this?

View 1 Replies View Related

Android :: Changing Values Inside Layout Included With Include

Oct 28, 2010

I have in many of my screens that re mostly constructed of LinearLayouts a FrameLayout that should take up the bottom leftovers of the screen (using layout_height="0dp" layout_weight="1") inside it there's a FrameLayout with gradients background and in it's middle with some padding lies a button with some text, naturally i need the text and onClicked properties to me different from screen to screen. I considered using <include > tag for the above compound in my layouts, but as far as i can see i can't really change (at least not in xml) the button text and callback, is that really so?

View 2 Replies View Related

General :: How To Install Multiple Instances Of Same APK

Jan 25, 2012

I was tinkering and editing an apk, and i managed to compile it and install it fine and it works and is suited to me. So i was wondering ( not too good with xmls ), is it possible to edit the manifest file to rename the apk so I can install multiple copies ( i.e. have the original unmodified one and the modified one at the same time ). I need this for testing purposes. Which lines do i need to edit exactly so the phone doesn't give me the "installing this application will replace the current..." warning, so I can multiple instances of it?

APKs are managed by package name, not by file name, but you can't simply change the package name in the manifest of a compiled APK.

Even assuming you manage to do it without messing up the file, which is not a simple task, there will still be code referring to the package name, so the app will crash.

View 4 Replies View Related

Android :: Intent Filters - Prevent Creation Of Multiple Activity Instances?

Feb 16, 2010

I added an intent filter to one of my activities, so that when a user clicks a URL like "www.mysite.com", and if my app is installed, my registered activity can be launched. It works well.

I see that this creates a new instance of my registered activity though, every time a link is clicked. Is there any way to prevent multiple instances from being created - just recycle an existing instance if one already exists?

View 6 Replies View Related

HTC Incredible :: Run Multiple Instances Of Calendar Widget?

May 3, 2010

OK, here goes my first post.

I have the calendar syncing with my gmail calendar, which has multiple calendars inside (mine, my wifes, ours, baseball schedule, cavs schedule, etc..)

I also have the stock "mail" (not Gmail) application syncing with my exchange at work.

Since I got 7 home screens to work with, I wanna put my Gmail calendar on home screen #1, and my exchange calendar on home-screen #7. Sort of a seperation of home and work

So I put the stock widget on home-screen#1, and again on home-screen#7. But a widget is basically just a frontend for an app running in the background. When I go to home-screen#1 and select MINE, WIFES, and CAVS.......that selection affects the widget on home-screen #7 as well. I go to screen #7, tell it to display Exchange only.......and when I go back to #1, it is switched to exchange.

So.....any way to do what I want?
1) Have a calendar on home-screen#1 that shows my Gmail calendar(s)
2) Have a calendar on home-screen#7 that shows my Exchange calendar

View 2 Replies View Related

Android : Multiple Activity Instances Launched By Same Intent. Bring One Uniquely To Foreground?

Nov 12, 2010

I'm struggling with my app that launches multiple instances of the same Activity using the same intent. My main activity is of class type A and it does a startActivity() of two children that are of the same class type B. So we have B1 and B2 launched. If B1 and B2 are both paused (by pushing back button and making sure finish() is not invoked on them so they are truly paused), how can A uniquely bring either B1 or B2 to the foreground again? I do want to launch a new B activity. I want to uniquely bring B1 or B2 to the foreground.

so both B1 and B2 were created like this... Intent intent = new Intent(context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);

Now I want A to bring B1 (or B2) to the foreground/front so I use the below code, but how do I distinguish B1 or B2 when starting the activity? This only brings the last instance of B that was on top to the foreground.

Intent intent = new Intent(context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent);

I've tried keeping around references to B1 and B2 and doing something like this, but this also only goes to the last instance of activity class B that was on top...

Intent intent = new Intent(B1context, B.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); B1context.startActivity(intent);

I even tried this, but it still doesnt get me my unique B1 or B2... Intent intent = B1.getIntent(); // i.e. the original intent that started me startActivity(intent); // still only brings to front the last B that was on top.

View 3 Replies View Related

Android :: Differentiate Emulator Instances And Real Device Instances

Jul 22, 2009

I need to correctly be able to differentiate between emulator instances. I know it's easily done with real devices. With real devices, you can use getDeviceId or getLine1Number from TelephonyManager. With emulators, all the instances have the same device id, same subscriber id, and same line1 number. Is there a way to differentiate them? Using NetworkInfo, I can call the toString method and I get my ip and the port on the computer. The problem with that is that the port is always different. I would like something more stable. Like when you use "adb devices" in command line. Emulator #1 is almost always "emulator-5556" and emulator#2 is almost always "emulator-5554". Is there a way to get the same info I get from "adb devices" in my code? If not, is it possible to use a command line parameter to force the emulator to use a certain phone number?

View 3 Replies View Related

Android :: Running Android JUnit Tests With Multiple Included Auxiliary Projects

Nov 18, 2009

I cannot run android junit tests for classes sitting in main android project that implement interfaces that reside in other included projects. Depending on SDK version I get different errors: from "Test run failed:" on 1.5 and 1.6 and spurious process death to a more polite "NoClassDefFoundError" on SDK 2.0. This happens only on instantiation of classes that reside in the Android project and implement interfaces residing outside that android project. There is no problem instantiating classes that do not fall into this category (i.e. android only or library only classes).

Android project by itself works fine with these classes - it is just the test set-up doesn't and project inclusion/classpath seems to be ok. Test project includes all projects that main project includes. NoClassDefFoundError makes little sense here given that the classloader can see and instantiate classes sitting right next to the ones that do not work. Did anyone else run into this or found a way to set-up android based tests in a multi-project set-up? Below is more detailed set-up and test explanation: 1) Library project: FooLib public interface IFoo { ... }

View 4 Replies View Related

Android :: Layout - Multiple Shapes ?

Mar 17, 2010

I'm trying to build a layout where some shapes will popup every 2 seconds. If the user will click one of these shapes, they have to disappear.

What is the correct way of doing this? I thought about a thread, but i missed out.

Here's my code at the moment (is not working):

CODE:..................

View 1 Replies View Related

Android :: Multiple Line Editview In Layout XML

Aug 11, 2010

I want to create a multiple line editview to enter in some notes. I want the text aligned top left and 4 rows. How do I create that in layout xml file. Assume I am using a linearview.

View 1 Replies View Related

Android :: Way To Do Linear Layout With Multiple Lines?

Jun 20, 2009

Is there a way to do a linear layout with multiple lines? I want to lay out a variable set of buttons with variable labels, so I'd like to use a layout that works as a simple horizontal LinearLayout, but with multiple lines, so the buttons spill into a second (or third) line if they don't fit on the first one.

View 3 Replies View Related

Android :: Multiple Expandable Lists In A Layout

Jul 30, 2009

I want to have more than one expandable list within a layout. It appears that an expandable list in a custom layout must have an id of "@id/android:list". So, how could I have more than one if they would need to have the same id?

View 1 Replies View Related

Android :: Layout - Displaying Multiple Colums

Nov 17, 2010

I want to display text such that it would be like:

TITLE 1.1

text about title 1.1

TITLE 1.2

text about title 1.2

TITLE 2.1

text about title 2.1

And so on

It would be a scrolling windows, but another problem is text could be lengthy and could span multiple lines. What do you recommend i should breakup my layout with. The length will be more then the screen height so i need scrollbars. Plus need to keep title bold.

Basically i would be printing this text from a String Array. Is it possible to display it directly from arrays or i can also work with simple strings but need to know how should i breakup my layout. like scrollview -> table layout or what?

View 1 Replies View Related

Android :: Adding Multiple ImageViews To A Layout

Aug 31, 2010

I need to load several ImageViews into a layout. The ImageViews are used to show a rating using 'star' icons. The number of stars (i.e. the rating is determined during loading by reading a configuration file.

The ImageViews are sitting inside a RelativeLayout layout.

Currently I am using something like this:

CODE:........

My quesions are:

1) Is doing the loading dynamically (not using an xml) is the 'right' way of doing this ?

2) If it is, how do I make the stars display in a line, currently they get placed one on top of the other.

View 3 Replies View Related

Android :: Layout For Multiple Screens / Emulators With Same Resolution But Different Density

Nov 11, 2010

I am trying to develop an application for which I want multiple screen support. I have read the Android article on Best practices for Multiple Screen Support. As per the article we have to follow 3 important things

1. Mention support for different screen sizes(large, medium and small) and any density in AndroidManifest.xml.
2. Place images of 3 dpi's (120, 160, 240) in 3 folders res/ldpi, res/mdpi and res/hdpi.
3. In layout's the dimension should be mentioned in "dip" units. Then Android will take care of the scaling on its own.

I have implemented all these points in my project. The images are picked up correctly from the appropriate folders. But the arrangements of the controls in not same.
e.g. I ran the app on three emulators
1. Resolution 240*320 dpi 120.
2. Resolution 240*320 dpi 160.
3. Resolution 240*320 dpi 240.
(All the emulator have same resolution but different density.)

The problem is the position of the controls is not same on all the three emulator. As per my understanding if the android:layout_marginLeft and android:layout_marginTop are mentioned in "dip" then this problem should not occur. As the density of the emulator increases the controls get placed more towards the right. Is it absolutely necessary that I provide layouts for all combination's of screen dimension and density even if the layout is same for all the devices?

Images:
https://docs.google.com/leaf?id=0By3GYC3k5AMDNzUwNjkwMWEtOGQzZC00MjQ0LWE2OTgtYjFhYzZmM2ExOGVl&hl=en&authkey=CLOEsZsI

View 1 Replies View Related

Android :: Multiple Screen Support - Size / Image And Layout

Nov 11, 2010

I am trying to develop an app for which I want multiple screen support. I have read the Android article on Best practices for Multiple Screen Support. As per the article we have to follow 3 important things:
1. Mention support for different screen sizes (large, medium and small) and any density in AndroidManifest.xml.
2. Place images of 3 dpi's (120, 160, 240) in 3 folders res/ldpi, res/ mdpi and res/hdpi.
3. In layout's the dimension should be mentioned in "dip" units. Then Android will take care of the scaling on its own.

I have implemented all these points in my project. The images are picked up correctly from the appropriate folders. But the arrangements of the controls in not same. e.g. I ran the app on three emulators 1. Resolution 240*320 dpi 120. 2. Resolution 240*320 dpi 160. 3. Resolution 240*320 dpi 240. (All the emulator have same resolution but different density). The problem is the position of the controls is not same on all the three emulator. As per my understanding if the android:layout_marginLeft and android:layout_marginTop are mentioned in "dip" then this problem should not occur. As the density of the emulator increases the controls get placed more towards the right. Is it necessary that I provide layouts for all combinations of dimensions and density i.e. in layout-small, layout-large, layout- medium, layout-long,layout-notlong?

View 2 Replies View Related

Android :: Layout Issues For Multiple Screen Sizes / API Versions

Jan 19, 2010

I am currently trying to make my app compliant with all screen sizes / api levels. I have this mostly working, however there is 1 issue i cannot resolve: Layouts in the "layout-hdpi" folder are used by and any phone on 1.5 (API level 3). - Which i dont want, i want API level 3 phones to use the "layout" folder. So to resolve this I added "-v4" onto the folder also, this works, the folder is no longer used by 1.5 phones. However, now the folder is also not used on API Level 6 phones, for example the droid. The droid only picks up the folder if i name the folder: "layout-hdpi-v6". (Also if i put "-v3" on a folder, the layout folder is not used by API level 4 phones) My understanding is that the -v<api level> qualifer allows you to exclude phones on an API level that is too low, so -v4 should mean that the folder will be used by all phones on API level 4 and above. I am finding a folder is only used for that specific API level. Has anybody else ran into this same issue? And does anybody know of any possible solutions?

View 3 Replies View Related

Android :: Scaling ImageButtons For Multiple Resolutions In Layout XML File?

Oct 4, 2010

I have a button which I want to occupy 75% of the screen:

On a 480x800 resolution screen this would be 360 pixels wide.
On a 280x320 resolution screen this would be 210 pixels wide.

How do I go about specifying this in my layout XML file?

I understand there is a DIP unit of measurement, but does that also work to scale screen images for resolutions? What DIP measurement would I use for this, and do the images need to be saved at 160dpi.

View 2 Replies View Related

Android :: Multiple Custom View (Derived From Relative Layout) In One Line

Sep 15, 2010

I have created a custom view by extending Relative Layout and it looks like this: The layout for the view:

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="center_horizontal">
<ImageView android:id="@+id/type_picture_preview"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/type_picture_noimage" android:layout_alignParentRight="true"
android:paddingTop="15dip" android:paddingRight="15dip" />
<ImageView android:id="@+id/type_picture_delete"
android:src="@drawable/type_picture_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
</merge>

I am struggling to get two or more layouts on a single line.

View 2 Replies View Related

Android :: Access Views Inside Layout When I Reuse It Multiple Times?

Aug 6, 2010

I have read the Android UI trick 2 on Android developers, which tells people how to include a layout in another layout file multiple times, and give these included layouts different id. However, the sample here is overwriting the layout id, not the id of the views IN this layout. For example, if the workspace_screen.xml looks like this: And I include it three times in another layout file. Do I end up with three TextViews with id firstText, and another three with secondText? Isn't there an id collision? And how do I find the secondText TextView in the third included layout with findViewById? What should I input in the findViewById method?

View 1 Replies View Related

Android :: Create A Layout - Multiple Scrollable ExpandableListViews In A Vertical Linearlayout?

May 7, 2010

Any insights/pointers regarding creating a layout like this. I have wasted quite a bit of time on this. I want to create a vertical linearlayout which has multiple ExpandableListViews separated by TextViews.

CODE:.........................

I tried the following approaches but each of them has one shortcoming or the other:

1. Add TextView and ExpandableListViews to a linearlayout. The problem with this approach is that LinearLayout by default is unscrollable.

Adding the LinearLayout to a ScrollableView creates even more issues because ListViews handle their own scrolling behavior.

2. I tried using a single ExpandableListView to model the above layout but the problem is that setGroupIndicator applies to the entire ExpandableListView, not a specific group.

View 2 Replies View Related

Android : Get Resolution - Programmatically Set Layout Folder / Supporting Multiple Screens

Aug 19, 2010

My application will have two layouts, one for large screens and one for normal. For testing I'm working with one phone (800x480 240dpi) and one tablet (1024x600 240dpi) but both are detected as large screen hdpi and long aspect ratio, so I'm not able to assign different layouts.

The only approach I think that can work is to create layout-large and layout-normal, get the resolution and programmatically set the layout folder. Is that possible?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved