(Android) ShareActivity crops space from the title - android

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?

Related

Whatsapp error Audio/Sound setResult intent

I have an app that can send a normal intent by calling startActivity with:
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("audio/*");
sharingIntent.setPackage("com.whatsapp");
sharingIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.fromFile(filepath));
startActivity(sharingIntent);
But i want my app on whatsapp attach menu (Audio Item specifically) like this related discussion example: Returning an Image to whatsapp
So, i used the code below, my app is showed on menu but when i do the share steps i get whatsapp "Share failed, please try again" error message. Others similar apps do the steps with the final step showing the Whatsapp Recorder dialog to apply sound on chat.
On this second feature (whatsapp internal intent-filter sharing) i use the same intent but with this:
setResult(RESULT_OK, buildSoundShareIntent(soundId));
finish();
instead of startActivity
Is there something specific and hidden that i dont find?
The solution is below my noose all the time, its simple: call the Intent constructor with action and data (Uri.fromFile(File)):
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND, Uri.fromFile(file));
setResult(sharingIntent);
In camera Settings; set storage to "Ext. SD card". Also, move any older photos you want to share to Ext. SD card. This worked perfectly with me. Hope it will work for you.

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.

Callback from chooser

I just started implementing a share functionality but was wondering if its possible to tell how my content was shared (facebook/twitter/text/etc) without writing my own implementation of chooser. My initial guess was to use startActivityForResult when launching the chooser but haven't managed to figure out which requestcode to use.
public void share(String subject,String text) {
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(intent, getString(R.string.share)));
}
Any help would be greatly appreciated! :)
My initial guess was to use startActivityForResult when launching the chooser but haven't managed to figure out which requestcode to use.
That will not work reliably. ~99% of activities are not set up to work with startActivityForResult.
I just started implementing a share functionality but was wondering if its possible to tell how my content was shared (facebook/twitter/text/etc) without writing my own implementation of chooser
Sorry, you will need to write your own chooser for this.

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.

how to show activity chooser menu when dialing in android?

I am trying to show activity chooser menu when dialing a number. Following code works for me when sending an email (from real phone,doesn't work in emulator):
/* Create the Intent */
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
/* Fill it with Data */
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"to#email.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");
/* Send it off to the Activity-Chooser */
this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
But when I change the code as:
Intent call = new Intent(android.content.Intent.ACTION_CALL);
call.setData(Uri.parse("tel:" + phoneNo));
this.startActivity(Intent.createChooser(call, "Hello there..."));
No activity chooser menu is shown, just straight dial. I also want to list skype in that menu. Do you have any idea?
As someone else answered in one of your previous questions, you really do need to read up on Intents and Filters. I'll give you a quick explanation though. An Intent is a type of message that Android applications can register to handle. If Skype is not installed, then it won't be able to register for that Intent and so won't show up in that menu. If it is installed and still doesn't show up, that means it's not registered for that Intent. I don't know the Android Skype app, but judging from the picture you linked in the other question, it seems that it does register for that Intent and will show up when installed.

Categories

Resources