I am working on sencha touch2.0 app and I want to send data from one screen to another. I know this question has already been asked here but I don't find it helpful so I am asking it here again.
I have a checkbox listview in my app and what I want is that when I click on one or more checkboxes and go to next screen, I will get all the 'checked' list items here, means I want to send checked list items data from one screen to another. From my research on net I came to know, this can be done by dispatch() method http://docs.sencha.com/touch/2-0/#!/api/Ext.app.Application-method-dispatch. But I don't how to do it. So, please provide me any suggestion/solution to get rid of these problem.
Ext.dispatch() is deprecated in Sencha Touch 2.0 because of the fact that you can always call any method of any controller at anytime you want through this, right in your views:
yourAppName.getApplication().getController.method(params)
Or even further, you can make it automatic through refs and controls in your controller.
Related
Use case:
Enable the Google TalkBack accessibility service and navigate to an
app (e.g. Google Messenger)
In this app, assuming that you'll be presented with a list of items
to select, arbitrarily navigate to one of them using Talkback gestures (swipe right or just click once on one of them)
Rotate the screen
Expected behaviour:
The previously highlighted item should still be highlighted; the user
should be able to continue it's navigation
The Google Messenger app is a perfect example of this correct
behaviour
Messenger After rotation
My Sunshine app behaviour:
The previously highlighted item is not highlighted after Screen
Rotation
The user has to navigate again to the previously selected item
Depending on the screen, finding and having an item selected again can be a pain... not what we want to induce to our user
Sunshine After rotation
How should we implement this?
I'm thinking, as a solution, at Accessibility Events and intercepting them... but this doesn't seem to be right, doesn't seem to be "best practice" (e.g. creating a Custom View and implement the methods handling these Events)
! Note that the green highlighted list item doesn't seem to be focused (getCurrentFocused() returns null)
! Note that the list items become focused if we use D-Pad navigation, instead of TalkBack navigation (but this is another discussion...)
L.E:
I've spend a whole day on this, trying to "get the focus" of the
highlighted item, but the item is NOT focused. This is why I assume
that this feature must be tackled in some other way and I would like
to know your (!) experienced opinion before I spend another 2 days
re-creating all the used Android components (as I assume it could be done - this doesn't sound very "best practice", doesn't it ?)
This is NOT a homework, there's nothing wrong with my current code
(so, there's no code to post, unless one would like my whole project)
and, given that this is my first post, I could not attach more than 2
pictures (this is why the "before" screens are missing)
Just give me a good hint, based on experience, and I will implement it and post the finished, working code here.
It should work out of the box if you implement stable IDs in your RecyclerView.Adapter (and potentially disable the ItemAnimator on the RecyclerView (rv.setItemAnimator(null)) which you can do conditionally if TalkBack is enabled).
Here's a blog post I wrote about the item animator bug.
I ran into the same problem while working on the same project.
Hint: listView.setItemChecked(int position, boolean value);
Good luck :)
here i want to develop an app that can run a simple quiz for psychology character test, but here i need some advice on how to show the question on the activity. Because i want to showing each question without moving to other activity.
This is my temporary layout (it's still ugly XD), but i want the question can appear on the inside of that red box. And when user press Next button, the question inside that box can changed but before it change the app has been stored the answer of previous question.
I really don't know how to use fragment or something like that.
NB. This is my mainActivity look :
For your app I would recommend not to use fragments at all, it will make your app much slower than it can be.
What I would do in your case, is only load the new question in the textbox on pressing next, and call an asynchronous function (asynctask) to perform the storage of the answer. This way the user sees no delays whatshowever.
If getting the next question required a server connection, use a progress dialog in between to show the user something happens.
Agree with Bas van Stein, using different fragments will slow down the app. What you could do is separate frequently changing part of your screen (e.g. question with answer options) into a fragment and reload it's data on Next/Answer button click. This will separate the code and make it easier to maintain and change it later.
On the other hand you could do it in the activity itself if you don't want to use fragment.
Before that I start explaining the problem I need to say one thing: I'm totally new to android programming, I can use java without problem, but i still don't know the android packages and classes.
I have a LinearLayout with 2 columns, inside the first column there are some buttons, the second contains a scrollView, in this scrollViewthere should be some... items that the user can add, those items have a title and a text, i already defined thoose objects in another class, and i add them to the scrollViewfrom a button.
From now i put in that object a button that is used to delete the item, but now i realized that it's really ugly, so i was thinking: is it possible to allow the user to drag and drop the item out of the screen to delete it?
I could surely do it by managing the event of pression and release on the item with some listener, but i'm almost sure that there's some android class created for sliding UI components.
Something like what you do with android notification.
I post an image of how the current app is so you can understand better what i said: http://i.stack.imgur.com/fHWK3.jpg (I don't have enough reputation to post images)
If i wasn't clear just say and i will edit with the requested information.
UPDATE: After reading the resource that Bonatti posted in his answer i added a OnLongClickListener for starting the drop, and a OnDragListener to look the cordinates during the drag, now i have a problem... I need my component to be dragged only horizzontally like how you usually remove notification from the notification bar, i thought about the fact that i could save the Y-location of the shadow created by the DragShadownBuilder when i create it, and then i could check in the OnDrag event if the Y-location now is different from the beginning i correct it, but the problem is... how can i access the shadow's location?
The basics of what you are asking for can be found here:
I cant post more than 2 links, so redo these:
http:// developer.android.com/guide/topics/ui/ drag-drop.html
These other might help with what you need in details:
Link 1: code.tutplus Or Link 2: vogella
They both answer what you need.
To put it simple:
You need an "action" to receive that a button/something was pressed (and that is still being pressed), and then update the screen to match the item position
In my app, I want the user to be able to follow this list of instructions to be able to put a link to their installed android apps into a widget that I am creating.
In the widget, when the user taps the widget it opens up a new activity which contains all of their apps. To add new app links to that activity, I want the user to be able to pull out a kind of scrolling tab that would hold a list of all of their applications they have on their device (I already know how to do this). The user would then be able to press and hold on a app from that listview and then drag it into the droppable area in the widget that would hold their app. Please note the picture below to get a better idea of what I mean (sorry for poor quality):
How could I turn a listview object into something that is able to do this? I would have to make the listview have a touch listener attribute and then make the droppable area have a drag event, that much I am sure of (somewhat from just looking around on how to make things drag and droppable).
How could I do this? Any ideas or comments on improvements are appreciated!
You could use setOnItemLongClickListener to set a listener waiting for a long click then when it is fired begin the drag process.
Please don't delete it because its a duplicate. I am an android developer with little experience. I have an app with 2 screens. The first has a bunch of options in a TableLayout each selected using a RadioButton.
What I want to do is, when I select one option and click a Button which appears below, the View should switch to the next screen showing some related data and when a Button is clicked I want it to come back to the same screen but then the rest of the options should be available to me so as to repeat the same process with another one of the options selected.
In short I want to be able to maintain the state of the first screen. I can't seem to be able to decide between using ViewSwitcher, ViewFlipper, or multiple Activities or using a single Activity which is what I am doing right now. But as my app gets bigger its very difficult to handle it. Please suggest the best way to do this. I am confused and desperately in need of help because my job depends on it. Thanks in advance
Use 2 activities. Launch the 2nd activity when the user clicks the button. When the user clicks the "back" button (or some other button you offer him) the 2nd activity finishes and the first activity (which was underneath it) is shown.
Note: You've not given us much information, so I can't guarantee that this is the best solution. From what you've said this is the solution I would recommend though. As they say in advertising "Your mileage may vary" ;-)