I have tried using this syntax but it depicts that "Cannot resolve method 'into(android.widget.VideoView)'" when retrieving video (https://i.stack.imgur.com/EScos.png)
I want to retrieve video in VideoView as well as its TextView from one layout to another layout after a user clicking on the data to view more details about the data at the other page.
Related
How to make validation in android studio for image view.
E.g. I have button when i click on button it open a gallery and i select image it comes in image view but how to set that if someone not upload image it will show message till not upload image in image view
Thanks.
The uri or bitmap that you use to save the image, use it in sharedPreferences. So that when the default value is null user will get the message but when you add a new image it will overwrite the default value of sharedPreferences and hide the messgae.
I am new to Android Espresso library. Trying to test click on RecyclerView item inside the ViewPager. I've searched the Internet but found nothing about ViewPager. So my question is: how to access RecyclerView inside a ViewPager using Espresso to perform click?
Let's suppose you want to tap on buttonClick, which is the id of a button inside your RecyclerView.
I use this code:
onView(allOf(withId(R.id.buttonToClick), isCompletelyDisplayed()))
.perform(click());
This gets the view with this id which is currently displayed and performs a click on it.
Hope this helps.
P.S.: Also, on espresso-contrib there are RecyclerViewActions that maybe you can use: actionOnHolderItem, actionOnItem and actionOnItemAtPosition. You can do something like:
onView(withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
How can I add VideoView programmatically according to the number of videos in specified folder? Any suggestions please or some links to learn from. I am new to Android. I don't want to add VideoView in activity layout.
you can add video view pragmatically like this:
RelativeLayout layout = (RelativeLayout) findViewById(R.id.layout);
VideoView video = new VideoView(this);
video.setVideoURI("yourURI");
video.setLayoutParams(new FrameLayout.LayoutParams(550, 550));
layout.addView(video);
I'm trying to build an android app to stream online radio.
Currently it starts to shape up and works like this: When I click on a gridview item in MainActivity, it starts the AndroidMediaPlayer activity that streams a fixed url and shows a fixed image that doesn't represent the users selection.
Code: https://github.com/sthlmj/IORadio/tree/clickable-funktionen/app/src/main/java/se/mookito/ioradio
Now I am trying to make it work properly, so that if I click on a certain gridview item, the image and the stream url should play according to the selection. I started by trying to get the picture to be displayed correctly by trying to pass clicked position from the MainActivity
of the items ArrayList in MyAdapter via intent so that I can setImageResource on the second activity AndroidMediaPlayer according to selected image from the first activity MainActivity.
In the second activity I tried to get the intent data:
//Selected image id
int position = i.getExtras().getInt("id");
MyAdapter myAdapter = new MyAdapter(this);
//Set image id
ImageView imageView = (ImageView) findViewById(R.id.mp3Image);
imageView.setImageResource(myAdapter.items.get(position));
But I got: 'setImageResource(int)' in 'android.widget.ImageView' cannot be applied to '(se.mookito.ioradio.MyAdapter.Item)'
Call imageView.setImageResource(myAdapter.items.get(position).drawableId); instead.
I am trying to create an app that will have a listview in it when clicking each listview will open an .xml file containing data and images stored into database.
I just want to know how to implement them into .xml and present into listview.
Thankyou
Actually you have to create another activity which inflate your xml which contain ImageView and more.and then pass id as intent and access content from database using id.and set image in imageview accordingly. This link may help you
http://yournextleap.blogspot.in/2012/02/insert-image-to-database-and-display.html