What is the name of the new bottom menu in Lollipop - android

I'd like to use the new bottom menu of lollipop, but I don't know the name of the View. Does anyone know its name? This menu can be used to shows video?
This menu shows on long click on the home.

Bottom menu? It's a simple Share Intent view that the OS pop out.
You can get it via:
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, "Test text");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Test subject"));
shareIntent.setType("text/plain");
context.startActivity(shareIntent);
Or instead of starting the activity like this, you can do the following:
startActivity(Intent.createChooser(shareIntent, "Share is via..."));

That's the menu created by the Intent#createChooser(Intent, CharSequence) method. And I doubt you can show video via it.

Related

Show share menu like other apps on my android phone

I have added share action on my app's actionbar and followed these steps:
http://www.codewithasp.net/2016/11/share-action-provider-android-application-actionbar-appcompat-v7.html
This is showing a nice simple looking share menu on my actionbar. But problem is that all other application on my phone have different share menu and all of them are similar.
Here is how my share menu look:
Here is how other apps showing share menu on my device
Instead of creating a drop-down menu with share options, you should just call share intent once you've clicked on share button or menu option. That way the list of possible apps would be shown as on the example you've pasted.
Here is an example of how could you do it.
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, content);
sendIntent.setType("text/plain");
getContext().startActivity(sendIntent);
There was one more thing to add in SadClown's answer and I got what I wanted. Actually while calling startActivity instead of just pass your share intent we need to call intent chooser
getContext().startActivity(Intent.createChooser(sendIntent, "Share"));
It is explained here in detail

Android share action. Trigger from navigation drawer rather than top bar.

My app has a navigation drawer and as one of its options on the left side I would like it to have "Share with friends". User can tap on Share with friends menu option and will trigger Android native Share action. Is it possible? Can you share with me a link on Tutorial or code sample on how to trigger Android Share action from other places like left side menu for example rather than top bar.
Thank you!
You can do this:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, "message to share");
startActivity(Intent.createChooser(share, "title"));

(Android) ShareActivity crops space from the title

I try to implement a share functionality in my app. But it seems impossible to make a nice title in the activity if I have a scrollable list in there.
Here is a picture that you know what I mean:
my shareActivity
and this is how it should look like:
google chromes shareActivity
The language is not the problem.
This is the way I try it:
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, url);
startActivity(Intent.createChooser(intent, "share"));
Did anyone has this kind of problem too and can help me?

Share links with my app using "Share via" in Android

I'm trying to set my Android application so that it's available to share links from other apps such as Chrome running on Android.
I have set an Intent Filter on an activity so that my app displays in the "Share via" dialog. That part works fine, but I'm not sure how to actually get the data into my "new post" dialog when it launches.
I read an existing StackOverflow question that suggests using this code:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, "I'm being sent!!");
startActivity(Intent.createChooser(share, "Share Text"));
I have an existing method for creating posts that looks like this:
public void onNewPostMenuSelected(MenuItem item) {
Intent intent = new Intent(this, CreatePostActivity.class);
startActivity(intent);
}
Should I modify this existing method and, if so, how? Or should I be doing something else? Thanks in advance!
I have set an Intent Filter on an activity so that my app displays in the "Share via" dialog. That part works fine, but I'm not sure how to actually get the data into my "new post" dialog when it launches.
If by "the data", you mean the text that was shared, call getIntent() on your activity and read the EXTRA_TEXT extra for that. In the case of browsers sharing URLs, EXTRA_TEXT should be the URL.

Filtering ACTION_SEND sharing options

I am using the following code to share information from my application.
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "share Content" );
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "share subject" );
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share Place via"));
The above code displays some options through which i can share, What i would like to achieve is somehow go through the options and omit some of them.
For Example , in my case, if Facebook app is present on the device, the above code displays it as one of the options. As i already have Facebook android sdk integrated in my application. I want to remove the Facebook option from the sharing options.
I think you should have a look at the PackageManager queryIntentActivities (Intent intent, int flags) methods. This will give you a list of Activities matching your Intentand then you can maybe remove some of them, and present a custom Dialog to the user, where you show just the desired Activities. And after the user chooses an Activity you'll have to explicitly start that Activity.

Categories

Resources