I have an app that on ImageButton click it opens the Gallery intent from where you can either choose some pictures OR take another one using the Camera intent.
My question is: I have made a camera layout that I would like to use instead of the one from the gallery intent. How could I use my custom layout instead of the basic one? Thanks
As far as I understand, you need Intent.ACTION_PICK
See details here: http://sudhanshuvinodgupta.blogspot.com/2012/07/using-intentactionpick.html
Related
I'm new to Android programming, and I have some questions about what type of layout to use. I am developing an application and have already done a basic mock-up of the interaction I want the user to have.
Following some tutorials I managed to build an app with a Bottom Navigation Bar with 3 Fragments, each one with it's own view. But my goals is that when the user clicks a button on one of these Fragments, the application opens a new View on the same Fragment.
What is the best way to achieve this goal? I have attached an image of the mock-up I made below, hope it helps to clarify the question. Thank you in advance for taking the time to help me!
Link to the mock-up app
That's sounds like you want to start a new Activity.
Considering you have your fragments in CurrentActivity and you want to start InvokingActivity
On clicking button in CurrentActivity
onClickMethod(View v){
Intent intent = new Intent(CurrentActivity.this, InvokingActivity.class)
//put some extras if you like
startActivity(intent)
}
To get arrow in top left corner you need to update AndroidMainfest by adding to InvokingActivity
android:parentActivityName="CurrentActivity"
I have a video playing in videoview in first activity. I want to to go to second activity and it should continue to play the same video (the video should not restart) in the videoview of second activity.
I am thinking to use intent to pass it's contents to video view of second activity , but I am wondering about how to resume the video from the same point.
Please help me. If any link or article is there related to that, please let me . It will be very helpful for me.
Thanks in advance.
To achieve the best result, use "Fragment" to display the video and also add another fragment to the same activity to display and do other stuff as you intend to do.
Although I do know how to open another activity quite easily, using intent like the below:
Intent intent = new Intent(first.this, second.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra("selectedApp", ApplicationTitle.getText());
startActivity(intent);
When you use the android application "PlayStore News", when you select a news item rather than just being redirected to another activity. An animation occurs, where in the change between several small cards to one large occurs.
How can I accomplish this?
http://www.mysamplecode.com/2013/02/android-animation-switching-activity.html
There is a method
overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out);
You might want to check out https://developer.android.com/training/material/animations.html#Transitions
This explains how to define custom transitions between activities. In particular, you may be interested in shared element transitions. I'd be more specific, but its a fairly broad question
Check this sample code for animation while switching activities in android.
http://android-er.blogspot.in/2013/04/custom-animation-while-switching.html
http://www.mysamplecode.com/2013/02/android-animation-switching-activity.html
I am developing an Android application in which I am showing a ListView of mp3 files from the sd card.
Now what I want is that when user clicks on any of the mp3 files it should start playing there on the same Activity. The code which I am using presently is not working for me to play audio files.
My code:
Uri uri = Uri.parse("/sdcard/music/sample.mp3");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
But this is something that I want. This is a screen Shot form android gingerbread
see this link here is a good example of getting all the music files and show in list and play when you click any item...
Display MusicList and play on itemClick
Another link
I suppose you should use another approach in case you want audio played in the same activity. I'd better initialize MediaPlayer object in this activity or as a background service.
In case of any questions feel free to ask.
UPDATE 1
In general case as I said you either need the MediaPlayer object in Activity or Music Service.
Now lets talk about controls.
You can simply put into your layout the block with controls and show/hide it when needed. MediaPlayer provides several convenient callbacks, so you will be able to update progressbar.
So, sum up:
Include controls into layout.
Include MediaPlayer into activity or make it work as a Service.
Bond controls to player.
???
PROFIT
I open a video in my application with an intent to the default player. It shows a gallery in the top left that would go to the gallery for the device which I don't want. Is there a way to customize it so that either that icon will fire the equivalent of the back button OR just remove it altogether?
I was thinking there were params in the intent or something that would be interpreted by the activity.
Goal: I want to be able to launch default player without the top nav bar. I feel it is something that i should just create my own VideoView for, instead of using a default player. I just didnt want the gallery button to point back to the gallery. Feel that might be some confusion.
I havent seen anything that told me of optional parameters i could pass into the video activity.