I have an activity that lists multiple records from a database stored in a data object that are presented in a TableView. When the user taps a row, the object is passed to another activity which will display all of the details. That activity uses a ViewPager to display the information on 5 pages using layout XML files in the instantiateItem method of my custom PagerAdapter class. The ViewPager works fine but I need to be able to "refresh" the pages with the data from the passed object immediately but the views on the pages are not yet available in the onCreate method of the activity. Is there some method to be able to accomplish this.
Related
I have created a custom module (actually I have created a handful in recent years, and this same obstacle frustrates me every time) following the Kentico documentation:
https://docs.kentico.com/display/K9/Creating+custom+modules
The problem I end up with every time, is in developing the User Interface for Parent/Child classes. I create a Vertical Tab node, and beneath it I add an edit tab and a Binding tab for the child class. This all works, and I can add and remove bindings at will, but what I can't do is ADD a new child class and bind it.
Using the Standard Edit Binding template, I am able to bind EXISTING Job Titles to the selected Category, but I cannot CREATE a new one from that page:
To solve this, I created a custom Edit Binding template, and added a New Child Class Header Action that points to a New / Edit Object child:
Which gives me a button that I can use to add a new child class (Job Title):
This approach works per se, in that I can click the New Job Title button and create a new item on the subsequent page:
But no binding is created to link the child object (Job Title) to the selected parent object (Category), An even bigger problem is that once I click Save, I am presented with the following:
The new object DOES SAVE, but the post-save navigation is somehow failing. The event log offers little in the way of diagnostics:
So I thought to create a completely custom interface to accomplish my needs here, according to the Kentico documentation:
https://docs.kentico.com/display/K9/Manually+creating+the+interface+for+custom+modules
So I change the Element Content of the New Job Title page to a custom page that I created to post a DataForm for the new object:
Taking care to assign the proper Object Types on the Properties Tab:
The intent was to programmatically create the binding upon save and also handle the correct navigation to avoid the ambiguous parameter error above, but when this page loads, the UIContext.ObjectID and UIContext.ParentObjectID are both 0:
So I cannot create the binding programmatically. I was able however to solve the error that I received by manually assigning the redirect. The experience is still lacking even with this hack, since it returns to the listing page, but the user still has to click "Add Items" to assign the binding after successfully creating it with the custom page I built.
This cannot be the proper way to do this, so any help with getting me on the right track would be greatly appreciated.
In order for the EditedObject to have a value you have to either decorate the page with the EditedObjectAtribute e.g. like this:
[EditedObject("<custom.objecttype>", "<objectid>", ...)]
or set the object yourself:
int objectId = QueryHelper.GetInteger("objectid", 0);
EditedObject = SomeInfoProvider.GetSomeInfo(objectId);
In your case, I'd recommend exploring what query parameters are available on the page and using them to fetch appropriate object(s). Also, make sure "JobCategoryId" is passed to the "New Job Title" dialog so that you can create the binding.
Btw - kudos for well asked question!
How to pass data from an activity to dialog?
Refer to the image below for more details:
You need to create a customized alert dialog .
Refer this link for creation of customized alert dialog .
According to your requirement , you need to add text view inside alert dialog with a boundary.
Even you can create a customized layout and set that inside alert dialog.
Passing Data from activity to dialog.Get data from activity , I assume it might be in string or integer format.
use setText() property of textview to pass data from string to textview which is inside alert dialog.
How to create an custom ListView? I have Adapter, but I don't understand how to create an View like ListView of the Facebook, or App for SMS native from device... I'm needing background for TextView, this background, will have an arrow pointing left or right, I tried to create a View using canvas, but it is very difficult...
Every line in the listView of a layout which can be as complex as you want.Just you need an extra xml file for managing you custom layout (it should be contains widgets,fields,images etc as your design ) and the adapter would inflate this layout file for each row in its getView () method and assign the data to the individual views in the row .
I am trying to use SplitView in order to show the information about employees. There is a list of departments in the Master part. The list of employers working in the chosen department needs to be shown in the Detail when clicking on the department.
I am using CoreData with two Entities: "Department" and "Employee" that are connected with “to-many” relation.
How should I do it?
Thanks
This is a simplified overview, since you asked a very broad question.
Create a UITableViewController subclass to be your Master view. It should have a property of type NSManagedObjectContext, and it should handle fetching and displaying the departments. (You could fetch them in loadView, or you could use an NSFetchedResultsController…)
Create another UITableViewController subclass to be your detail view. Give it a property of type NSManagedObjectContext, and also a property of type Department. Make it display the employees for that department. You'll want to make it reload its data whenever the department property changes.
Add a property to your master view controller, to refer to the detail view controller (so a property of type EmployeeViewController, or whatever you called it). Then in tableView:didSelectRowAtIndexPath: in your master view controller, set self.employeeViewController.department = <selected department>.
Create the split view controller. If this is the top level view of your application, you'll want to create it in your app delegate, otherwise create it in the view controller that pushes it to the stack. Here's how to do it (in pseudocode):
Create a new detail view controller
Set its managedObjectContext property
Create a new master view controller
Set its managedObjectContext property
Set the master view controller's employeeViewController property to your detail view controller
Create a new split view controller
Set the split view controller's viewControllers property to an array containing your master and detail view controllers
Get the split view controller on the screen somehow, either by pushing it onto the navigation stack or setting it as your root view controller in applicationDidFinishLaunching:.
I have a simple maps app with multiple pins on a map view. My intention is to tap a pin, show a callout with an accessory view, push to a Detail View Controller where you can edit that pin/locations details. This all works fine, but once i pop the Detail View Controller the callout on the map view is still there, which i want, but it still has the old uneditied values. How can i refresh/update the callout view once the Detail View Controller is popped?
I am using Core Data with a simple database. I have tried using controllerdidchangecontent, Map View Controller Will Display methods etc but my main problem is identifying which object has been added/updated/deleted and which is the corresponding callout/selected pin.
Any help appreciated...
Not sure if you had find your answer but the way to do it is to extend MKAnnotation class and creating custom annotation and passing them while creating placemarks. Later you can get them from MKAnnotationView's annotation property.
See a good implementation here
http://www.slideshare.net/360conferences/getting-oriented-with-mapkit-everything-you-need-to-get-started-with-the-new-mapping-framework
The only way I could find to update the callout info was to mess directly with the subviews of the callout.
The callout view is the first subview of the annotation view.
In the following example, I update the subtitle.The title label is the 6th and the subtitle is the 7th subview of the callout:
if (myAnnotationView.subviews.count > 0)
((UILabel*)[((UIView*)[myAnnotationView.subviews objectAtIndex:0]).subviews objectAtIndex:7]).text = #"Some example";