I have an intent
Intent(context, VisualCActivity::class.java).putExtra("Pox", BLBIndex)
thats works before.
Then I refactor the activity to another name and it works again ???
but the old name in the intent stays the same
But when I change the name of the activity in the intent to the new name
it does not work (unresolved reference)
What can I do?
Edit: I found the old activity name in the manifest
<activity
android:name=".VisualCActivity"
android:exported="false"
android:label="#string/title_activity_visual_cactivity"
android:theme="#style/Theme.LKPRG2023" />
Can I rename it here?
Android Studio shows in project window the new name
Found the mistake
class declaration name hasn't change - now it works
class FRMain : ComponentActivity() {
Related
I have a Dialog in fragment:
<core:FragmentDefinition
xmlns="sap.m"
xmlns:f="sap.ui.layout.form"
xmlns:core="sap.ui.core">
<Dialog title="{i18n>AddNewItem}" resizable="true" draggable="true">
<content>
<MessageStrip
id="failMsg"
visible="false"
text="{i18n>SensorTypesCreateFail}"
type="Error"
showIcon="true"/>
</Dialog>
</core:FragmentDefinition>
As in UI5 doc:
Retrieving a control instance when the fragment is not part of a view:
When no fragment ID was given: myControl = sap.ui.getCore().byId("myControl")
When a fragment ID myFrag was given: myControl = sap.ui.core.Fragment.byId("myFrag", "myControl")
If there is no visible="false", I can get this MessageStrip by sap.ui.getCore().byId("failMsg").
But I found that with visible="false", id of MessageStrip is sap-ui-invisible-failMsg, I failed to found proper API to get it.
Of course I can use sap.ui.getCore().byId("sap-ui-invisible-failMsg"), but I am not sure whether this ID will change after I deploy it to FLP, and as #schnoedel said in another question:
Beware that the prefixes like -- and --- used by the framework may change in the future. Thats why it's recommended to use the public api functions the framework supplies like byId() and createId().
So, is there any better way to get it?
Update:
Change my code from:
this[dialogName] = sap.ui.xmlfragment("namespace." + dialogName, this);
this.getView().addDependent(this[dialogName]);
To
this[dialogName] = sap.ui.xmlfragment(dialogName, "namespace." + dialogName, this);
this.getView().addDependent(this[dialogName]);
And now my id is sap-ui-invisible-dialogName--failMsg...
It depends on what you want to achieve after getting the ID. If you just want to change a property you could do it without any ID via a Model.
For that you can assign a Model field (i.e. baseModel>/visable) to the visable property and once it should be changed you change the model and via two way binding it updates the control.
code to change a model:
this.getView().getModel("nameOfUrModel").setProperty("property", "value")
for more information about this just check the walkthrough tutorial on
https://sapui5.hana.ondemand.com/
And if you for whatever reason really need the ID:
https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.Fragment.html
here you find the command:
sap.ui.core.Fragment.byId(sFragmentId, sId)
It should be able to return the Control your using
Hope that helps
Eric
You were very close to the solution. After adding dialogName for the fragment ID in its creation, you just have to call the API ...:
sap.ui.require(["sap/ui/core/Fragment"], Fragment => Fragment.byId(dialogName, "failMsg"));
... to get the control instance as mentioned here.
However, regardless whether you provided a fragment ID or not, you can easily ignore the render prefix "sap-ui-invisible-" at any time - Meaning that you could've also been able to get the control instance via sap.ui.getCore().byId("failMsg") instead of sap.ui.getCore().byId("sap-ui-invisible-failMsg") even if the control is invisible.
I am totally new to android and I have a question that I would thank a lot if somebody can answer me.How can I start a new activity from my android code? For example if in my current activity, string x1 = string x2, then I want to start new activity
Suppose your new Activity is called CoolActivity then you do the following to start your activity:
Intent intent = new Intent(this, CoolActivity.class);
startActivity(intent);
for your reference: http://developer.android.com/training/basics/firstapp/starting-activity.html
Do you want to create an other activity in your code?
Normally you only have one activity per view. If you want to start an other activity, you have to create an other file for exemple activity2.java
Add this activity in the manifest.xml like this:
<activity
android:name=".activity2"
android:screenOrientation="landscape" />
And in the beginning of your activity2.java, start with something like that:
public class Activity2 extends Activity{
I don't if i answered your question or not ...
I have two "loose" XAML files, each declarativly defining composite activity which is composed of some custom (compiled) code-activities.
Now, I would like the activity defined in the 1st "loose" Xaml to 'contain' the activity defined in the 2nd "loose" Xaml as of its steps.
However, I have no clue how to 'glue' both activities together such that 1st activity will know to correctly load the activity from the 2nd Xaml.
So when calling:
XamlXmlReader xr = new XamlXmlReader(#"FirstLooseActivity.xaml");
ActivityBuilder ab = (ActivityBuilder)XamlServices.Load(ActivityXamlServices.CreateBuilderReader(xr));
I end up with a XamlObjectWriterException (after I loaded all relevant assemblies to my hosting app):
Cannot create unknown type '{clr-namespace:SecondLooseActivity}MyActivity
Since there is no Xlink support in MS, is there a way to do this at all?
If not, what are my alternatives?
I had the exact same issue and found a solution.
Here's what my XAML looked like this:
<Activity ... xmlns:mylib="clr-namespace:MyProject.ActivityLibrary">
<mylib:MyCustomActivity ... />
</Activity>
The trick that worked for me was to specify the assembly containing my custom activity in the namespace.
Changing the namespace to this made it work:
xmlns:mylib="clr-namespace:MyProject.ActivityLibrary;assembly=MyProject.ActivityLibrary"
I am creating new Eclipse RCP application. I used "Hello RCP" as template project to create a new project. It works fine. Then I tried adding new menu. I used two extension points "org.eclipse.ui.commands" and "org.eclipse.ui.menu". I created handler class and also defined the menucontribution location uri(). But my menu is not showing up. I strongly suspect my location uri is wrong. But I dont know how to correct it. I have pasted my plugin.xml contents here. Let me know if anyone has a solution. I am following the steps given here http://zenit.senecac.on.ca/wiki/index.php/Add_Menu_to_RCP_Application
You can use ApplicationActionbarAdvisor class to define menus and commands for toolbar as well as menubar.
Firstly you have to declare the commands you want to add in your app like below:
private IWorkbenchAction newAction
Then with the help of ActionFactory class, you have to define the commands in makeActions() method like below:
newAction = ActionFactory.NEW_WIZARD_DROP_DOWN.create(window);
register(newAction);
newAction.setText("New");
Now, after declaration you have to add the commands in menus by using fillMenuBar(IMenuManager menuBar) method :
MenuManager filemenu = new MenuManager("&File", "file");
filemenu.add(newAction);
and if you want to add this command in toolbar, then you have to use following method:
protected void fillCoolBar(ICoolBarManager coolBar) {
IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle());
coolBar.add(toolbar);
toolbar.add(newAction);
Sometimes, you have to use IContributionIem class for declaring commands because all the commands are not in IWorkbenchAction class.
Note: If you are using iContributionItem class then declaration and defination code will be replaced as follws:
IContributionItem show_view;
show_view = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
and rest will be same.
I have a new MVC-2 project where I added the area 'member'. I created a controller named: 'profile'.
This works: http://localhost:1234/Profile (loads up the index() function)
This however doesn't: http://localhost:1234/Member/Profile (i get a 404 error)
Am I missing something here?
There's no reason for this not working. From the default project template:
Right click on the project Add -> Area : Member
In ~/Areas/Member/Controllers add ProfileController containing a default Index action
In ~/Areas/Member/Views/Profile add Index.aspx
Run the application and navigate to /member/profile => it shows the newly added page
Can you check your Global.asax.cs file, see whether it has the following code in Application_Start
AreaRegistration.RegisterAllAreas();
If http://localhost:1234/Profile works, you might need to check the namespace of your ProfileController. It should be:
namespace YourProjectName.Areas.Member