MonoDroid Change Activity Label or Title Programmatically - android

I have a gridview with pictures of equipment to select from. Once selected, the user is taken to an activity that summarizes all the info they need to know for that model of equipment. I'd like for the Label or Title of that activity to display the selected model of equipment.
It looks like in java to be as simple as setTitle(string), but this functionality doesn't seem to exist in mono. Looked at this, but you can only use integer or an existing drawable. I need to set it to a string.

You can set that via the Title property. In general, where you see setFoo/getFoo methods in Java, those will be mapped to a property named Foo in C#.

Related

how to getstandard value from Spinner with multilanguage app on Android

I've an App where user can post photo and give some attributes to it.
Users can determine which category the photo belongs within a set of default categories, i try to show the categories options in a Spinner and the values come from a xml array compiled into the app.
This way i can show the categories in whichever language user is running the app.
The problem i have is to convert the value got from spinner back into a standard set for store in my database. Because depending of what language user set, i get the value as a different word and is a nightmare to create a converter which could handle it and translate from N different languages into my standard enum.
I would like to do something like radiobutton, like each option has a label (in whatever langague user wants) and a value (which i can define in a stardard way) so when i get selectedItemValue() i always get same value independent of language.
Is there any way to do that?
I advise you to use res/raw/ with different qualifiers depending on your locals instead of using string array.
It helps you to store json files in them. So you can have a list of custom objects which have both title and id.
And you store id in the database, and id is the same in all locals.

Make a word in TextVew clickable

I am developing a dictionary app. When I search some keyword it will display its description. Now I want if any keyword (of my database) is used in describing other keyword I want that describing keyword to be clickable (and coloured or/and underlined). So that if I click on that word search will be made using the clicked keyword and will display the result. I am using SQLitedatabase to create database. Please see the attached picture.
Sample picture:
You can use spans to style your text shown on a textview. There is a span subclass called ClickableSpan, which will be able to serve your needs. Takea a look at ClickableSpan also there is another span class called UnderlineSpan which can be used for putting underline for the specified character range. Hope this helps

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.

Turn Words Inside an EditText Into a Contact Icon

I'm not quite sure what to even call this. Rather than plain text editing I'd like to implement the same system here, so when a user types in other users' names followed by a space the name is replaced with a view like below. What are the basic steps to get this effect?
They are called chips.
Here are some libraries that might do the trick:
https://github.com/DoodleScheduling/android-material-chips
https://github.com/klinker41/android-chips

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!

Categories

Resources