Replicate Contact details on Android - java

I am trying to use this method of viewing details of a list item in my own development, but I cannot seem to figure out the right words to Google. I was hoping to get some help on replicating this behaviour.
My current idea is to have a fragment with a higher z than the list and put a swipe listener in the fragment. Then when it reaches a certain height make it a full screen fragment, but I'm not sure if this is the proper​way

Related

I don't understand how to organise my fragments

I have realised an NFC reader application
So i have 3 activities :
MainActivity, which is an activity who contains a Button. If button is clicked, the scan is activated and the user can put his NFC tag against the device to detect it.
WebActivity, who is launched if the NFC tag contains and URL (and open a WebView) or if the user want to launch WebActivity by himself
HistoryActivity, who gonna contains a list of every scans.
Now, I would like to swipe activity with a finger gesture. according to my research on Internet. I need fragments and ViewPager.
But every example that I saw is bases on ONE activity and multiple fragments.
But in my case, I have to create 3 fragments (one per activity), right ?
And I really don't know how to manage my fragment. I mean, what to put inside ?
All I want to do is create a transition/animation while changing activity... That's crazy
This is too broad of a question but hopefully my answer will steer you in right direction.
You should definitely go with single activity/multiple fragments model. Aside of recommendations by Google, you could use navigation components, deep linking much easier then without single activity.
Yes you should be using ViewPager for the purpose (and likely your implementation of FragmentPagerAdapter as well) however I do not understand what kind of swiping will you be doing
Reading your setup, I would suggest to use bottom view with 2 items (good example is here https://github.com/android/architecture-components-samples/tree/master/NavigationAdvancedSample/app/src/main/java/com/example/android/navigationadvancedsample). 2nd one would show history, first one would offer a button that activates your action, and then displays fragment with your WebView.
As a side effect of such implementation, you'd be able to go back from 2nd bottom view item to whatever first one holds - by pressing system back button - which I think is nice touch.
UPDATE to "swiping takes place anytime. " comment:
You could have single activity, ViewPager with 2 fragments. First fragment would display a button, 2nd fragment would display a history. You could freely swipe between them, as you want to. However to me it does not make sense to put WebView screen into this. WebView screen is result of action (NFC detection) and it should probably display as full screen, without any chance of swiping between main/history and itself. Hope it helps or I'm missing some important piece of info you did not share.

How to increase the height of list row using fragments?

I am working with fragments and created simple basis list and everything is working fine. But there is one thing that I can't do my self. I want to increase the height of the each row to cover the most of screen of any device. I know how to do in activities but I am not familiar with fragments. Any one can find a way for me?

JavaFX Find index values of items currently in view

I am working on a project in JavaFX 2 and I am using a ListView to display a list of messages. The list is very long and so not all of it fits on screen. Is there any way to programmatically identify which items are currently in the view? I've searched everywhere online and I can't find any examples of a way to do this, nor does the API appear to have any notion of which items are on screen. Any help would be greatly appreciated, I've been working on this problem for quite some time.

Android 2.3 maintain ListView position when using Fragments

I have been trying to find a solution to this. How do I maintain the ListView position when I am using Fragments and someone rotates the device.
The rotation itself resets everything and it's back to 0 again. I can get it to work with the multiple examples when I am using normal Activities, but how do I do it when I am inside a specific Fragment?
Make sure that you do not call setAdapter() again on rotation or after any operation you do. Always call notifyDataSetChange() and your list will remain at the same point
Other workaround can be that you save the position of the current list item and call setSelection(position) for what you want to keep
You d have to store some kind of view tag or position number in a bundle on your on pause and in your on resume check if the value is null. If it's not set the list view to said position.

View different images depending on what item in my list view I click

I'm fairly new to Android programming and I've got this project I need to finish and I'm currently stuck.
I've got a standard listview in a Menu class with an array containing around 20 different elements. So what I want to do is load images in an imageview depending on which item in the listview I click, and since I'm a beginner the only idea I had was to make a new activity for each imageview which seems like a pretty bad way to do it since I'd need about 20-30 new activities..
To sum things up what I want is:
Code for making ONE activity that will display a different image depending on which item in the listview I click, probably pretty basic coding I want as simple solution as possible.
If possible I'm also looking for a solution that includes an SQLite database that stores the URL of an image and then display it in a single activity, also depending on which item I press in my current listview.
(I hope you understand my needs, and if you need I can also post my current code for the Menu class if it helps you help me) Or you can just show me a different way to make this work, I appreciate every answer! Thanks in advance!
NOTE
And please keep in mind, I'm a noob at Java and Android so keep it rather simple or at least explain what you do.
When you click on a list item, display the image in another view in the same layout, unless you want the image to take up the entire screen real estate. If you want it in the entire screen, go to a new Activity by sending the activity an Intent.
Activities are the "controller" of your application. They interact with the visible UI and the input from the user. You don't need a separate activity for each image, just an activity that's associated with a "place" in the UI (an ImageView) where you'll display the image.
I'd start by adding the images as resources under res/drawable before going on to databases.
You are going to have to do most of this yourself. There really isn't any substitute for taking the time to learn Java and Android. There are several tutorials and Android University classes under the Resources tab in the Developers Guide; I suggest you do all of them.

Categories