How to save XML of absolute layout pragmatically? - android

I have built application that enable the user to design his/her Business card. I have used absolute layout for the purpose of card designing. Now the problem is that how to enable the user to edit his/her card after saving the card. Do i have to save the XML of absolute layout to edit the card? or Is their any other method.
Please help me out. Thanks in advance.

First of all, you should not use AbsoluteLayout.
From the documentation:
This class was deprecated in API level 3.
Not sure exactly what are your needs, but a better choice would be RelativeLayout or a FrameLayout.
If you want to save the result layout, you might need to store all relevant information about the views in the tree and rebuild it once it is needed.
So for example, if you have a TextView in the card that a user added, save the text, color, margins, etc for that TextView. When needed, create a new TextView and restore the data.

Related

Is there a way to edit previously saved with PESDK photo?

The use case is the following:
for instance I added a text on an image. Saved the image. And now I want to edit this text. I am looking for a solution to open this image with a text in an editor with a possibility to make this text editable. In general, I need to do the same not only with the text.
What I thought about the way to implement such behavior is it would be good if there is some list of the operations applied to the particular image. And also a way to make editor apply these operations again and to have editing components active and available for editing
You can achieve this behavior by utilizing the serialization feature. More information about that is available at https://docs.photoeditorsdk.com/guides/ios/v8/concepts/serialization for iOS and https://docs.photoeditorsdk.com/guides/android/v5/concepts/serialization for Android.

Which Android widget should I use for a static text label?

I just want a simple non-editable text label but there doesn't seem to be a widget explicitly for it. The closest thing seems to be a android.widget.TextView. But the documentation says a "TextView is a complete text editor". That seems like overkill for a simple label. I don't want to bloat my application. Is there a more appropriate widget?
Or am I approaching this the wrong way? For example, let's say I'm building a settings screen, is there a layout I should choose which gives me labels for the properties so I don't have to specify widgets for the labels?
Is there a more appropriate widget?
No.
I don't want to bloat my application.
You won't, unless you put a ton of text in it. While TextView has a lot of code, your process will already have access to that code, whether you use TextView or not. The only "bloat" would come from the actual heap space used by the TextView object itself (and objects that it holds).
For example, let's say I'm building a settings screen, is there a layout I should choose which gives me labels for the properties so I don't have to specify widgets for the labels?
Typically, we would use a PreferenceFragment, backed by a preference XML resource, instead of having any layout or widgets.
But, if you wanted to roll your own for some reason, use TextView for the labels.

ListView, storage 2 columns [android]

I need an advice about ListView.
A give you an example:
Assume that i have a map. If i'll touch some place on it i'll get an information about that place and then, on screen, a dialog fragment will appear. In this dialog i can write a name of place, which i touched. The names should be saved into ListView but if i'll click on some of them i want to get information.
Can some of you tell me how i should do this? Is it possible to save that information in Shared Preferences?
Maybe you would get it work with SharedPref. but it isn't a nice way to that. I think the best way is to create an Android SQL-DataBase. Like in every other Database you could use one column for the name, one for the information text, one for coordinates and so on (that's just an example). The data will stay, also if your app is closed (like SharedPref).

Properties grid on Android - readonly and/or editable

I need to create a properties grid in my application to allow the user to read (initially) and eventually edit the properties of an object that I display using a custom list adapter.
I did some research and found that Android has the preferences activity, which sounds good as far as the UI portion, but I don't want to actually save "preferences", I need an edit screen.
Is there a way to have a dialog created which will use reflection (sorry, .net term) to create the dialog allowing the user to edit each property of an object, or do I need to create this manually? Either is ok, I just need to know. Thanks!

Android - EditText to StringArray stored in xml

Ive been attempting to work out how to take the text from an edittext box and move it into a string array located in strings.xml.
Basically its a user form which the user fills in, onClick it adds the information to the database and is then viewable in a listview. The listview and everything works fine but i cant work out to put in information using edittext boxes.
Any hints or techniques would be very much appreciated.
Thanks
You want to take user input for an edit text, and put it in strings.xml? You can't do that. String resources are for static strings, not things that will change at runtime. You should look at other data storage options, like shared preferences. See data storage.
I could be wrong (someone please correct me if I am), but I don't believe strings.xml is editable at runtime. Rather, it's a set of predefined resources that your app has access to, and it cannot be modified by the program--only read.
If you're looking to make this information available to your app for subsequent uses, you should look at using SharedPreferences: http://developer.android.com/guide/topics/data/data-storage.html#pref
No way. You can't do such a thing. Surely not with strings.xml and androidmanifest.xml too.
The other option you have is: if you already have some values in strings.xml, you can fetch them in an list and append your own values that you want from user. After that, put it in an adapter and display it in a list view like you usually do.

Categories

Resources