Hi all. I have literally spent days on this, trawling through git source reps, playing with "Intent Playground", scanning logcat over and over again and I'm tearing my frickin hair out. Perleees, put me out of my misery one way or the other.
Developing an app that does funky stuff with text. Works fine except the last TODO which is to add my app to the "Share via" chooser. Source apps for the text I'm targetting are primarily mail clients.
I've added an intent filter (in fact, tried every combination I can think of) but my app never shows in the chooser.
Code:
<intent-filter>
<action android:name="android.intent.action.SEND" /
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
Here's a logcat fragment showing the chooser being created:
Code:
09-30 20:51:07.964: INFO/ActivityManager(124): Starting activity: Intent { act=android.intent.action.CHOOSER flg=0x10000000 cmp=android/com.android.internal.app.ChooserActivity (has extras) }
09-30 20:51:08.374: INFO/ActivityManager(124): Displayed activity android/com.android.internal.app.ChooserActivity: 381 ms (total 381 ms)
09-30 20:51:30.374: INFO/ActivityManager(124): Starting activity: Intent { act=share typ=text/plain flg=0x13000000 cmp=com.htc.android.mail/.ComposeActivity (has extras) }
As you can see, the share action was initiated in this case from the HTC mail client.
Any ideas? A free copy of my app to anyone who can help out. I know it's not much, but what else can I offer
I don't see a "Share Via" in the gmail client.
There is one in Astro file manager though.
Your app should show up if you long press a .txt file from Astro and click Send.
Hi, thanks for the response.
I should have mentioned it works fine as a send to target but it's the share via chooser I want to extend.
Cheers
Found the solution
Hi folks
Finally found the solution. Very pleased about this because I was just about to offer a $50 reward for one
<intent-filter>
<action android:name="share" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
Click to expand...
Click to collapse
There is NO documentation on this that I can find and I've never seen another intent name in this format. Maybe Google only want partners to be able to add apps to the Share Via choosers?
Anyway, up and running now.
Cheers all
I understand that home-replacement apps are a little (a lot) different than regular app. How exactly would I go about binding (if that's the right word) a view() to the home. When the home button is pressed, I want my home-replacement to be in the list. How would I do that? What specific property or activity() would allow me to do that? Thanks in advance
Code:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
In the android manifest for your specific activity
Thanks
Thank you so much If you would like to know what I'm working on, you can visit my site at futurinnovations.blogspot.com. I would like all the help I can get.
Now that I can bind a gridView to the home, I need to know how to launch applications from that gridView. The gridView is made up of all the application icons, but I don't know how to make it to where the applications are waiting behind their icons. Oh, and can someone help me with making a free-form surface to place applications on that can be freely dragged and dropped? I have attempted to get the code from the example "Making Sense of Multitouch" from the Google Dev Blog to work. I enter in the code (not copy and paste, since I have my own variables and such) exactly like they do, run the application, and all I get is a blank screen. What am I doing wrong?
Sounds to me like you aren't inflating the XML
Sent from my ADR6300 using XDA App
Ummmm...it doesn't have an xml. I'm pretty sure that it is dynamically created. What would I put in the default xml? and how would I inflate it?
Hi people!
I'm trying to learn how to develop android apps. I'm not trying to become a developer but for fun and learn this. So I go step by step.In the past I just have very basic visual basic and fortran experience...I don't know java lang. But while searching I found out that android is based on java. so I grabbed netbeans and jdk. and it was easy and understandable to do some basic math(with tutorials) with it, like + - * /
So I thought I'd give a try to appinventor. Ok easy enough.Done basic math. But I want to learn the code itself.
So I'm dealing with eclipse right know. I learned some basic stuff which you can not learn with appinventor.
But when it comes to basic math, I'm stuck!
Let me explain:
with appinventor it's easy to make this (pics are at the end of the post)
when I try to make this with eclicpe...I'm going nuts. I couldn't find any tutor.
Strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Lorem Ipsum</string>
<string name="input"></string>
<string name="butcel">Button</string>
<string name="result">result</string>
<string name="ClickHandler">ClickHandler</string>
</resources>
Click to expand...
Click to collapse
Forum does not let me enter my main.xml and main.java codes. so I atteched the pics and txt files below.
this gives me a "app has stopped unexpectedly" error
what I'm trying to do is
1)user inputs a number
2)clicks on a button (there will be several buttons in my app,this is just a test app)
3)application does some math with that number
ie. ((number*5)/2)
4)textView1 shows the result
Should it be simple like in appinventor or am I missing sth in my codes?
And I'm not sure but do I need to add a java math function or sth like that in my app to do simple math like this?
Any advice is appreciated.
Thanks in advance.
The first thing to check is your AndroidManifest.xml file. The Eclipse ADT plugin should create this file and include the main activity for your app automatically if it has been installed. However, an app will throw the error you are receiving if an activity is run that isn't listed in the manifest and it's very common(at least for me) to forget at first to add a newly created activity to the manifest. Below is an example of an AndroidManifest.xml file from the Hello, Android tutorial.
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloandroid"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloAndroid"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Hi there desisamay,
to be honest i did not really look and your code to try and find the error, but i did write you an example app you can expand or use to learn .
Attached to my post is the example app and my whole eclipse project directory of it.
The app has an edittext to input a number, a button to start the calculation x*2/5 and a textview to show the result.
I hope you enjoy it and if anything is still unclear, just ask!
when the activity starts you try to get the text of the edittext and convert it to string which is null since the edittext is empty at the beginning. You should get the input when you click the button (and maybe even check if the edittext is empty)
Dark3n said:
Hi there desisamay,
to be honest i did not really look and your code to try and find the error, but i did write you an example app you can expand or use to learn .
Attached to my post is the example app and my whole eclipse project directory of it.
The app has an edittext to input a number, a button to start the calculation x*2/5 and a textview to show the result.
I hope you enjoy it and if anything is still unclear, just ask!
Click to expand...
Click to collapse
Thank you very much! This was exactly what I was trying to do! I was trying to do this with onClickListener and defining values... But your lines are clear and understandable and now I know how to make definitions and basic math functions. I think there'd be more lines to write with onClickListener. But this way is simple and works like a charm. Thank you again.
Also I've added
android:inputType="numberDecimal|numberSigned"
Click to expand...
Click to collapse
to EditText in main.xml just to be sure the user inputs numbers only. maybe just "number" will do the same.
But one more question:
we write the result to output like this
output.setText("The result of " + mInput + " times two, divided by 5 is " + mOutput);
do we have to use some text in it? if I try just
output.setText(mOutput);
eclipse warns me
The method setText(CharSequence) in the type TextView is not applicable for the arguments (double)
Click to expand...
Click to collapse
and underlines setText with red. but we 've already defined mOutput before like double mOutput = (mInput*2/5);
@MongooseHelix
My AndroidManifest.xml was the same as you posted. Since I only have one action. Thanks.
@nemoc 23
I was trying to that. get the input when button clicked. Convert to string of course and do some math. But I couldn't.(now I can ) But you're right for checking the edittext field after clicking the button. I'm pretty sure if you click the button with an empty edittext area, app will give an error.(i tried and it did)
When writing my little app I'm planning to add this and warn the user with a toast text.
output.setText( mOutput.toString() );
Hey Guys -
This is probably answered somewhere, but for some reason search isn't working at the moment.
So, first, keep in mind that I'm NOT an experienced developer - I have ONE app on the Play Store, and I learned both Java and Android through trial and error and more Google/DuckDuckGo searches than *they* are probably even aware of. When I first released my app, v2.3 or some such was the latest out. :laugh:
So now I'm working on bringing it into the new generation, and playing with fragments.
I've seen two main approaches with them - the first seems to be creating the fragments on the fly in code, as needed. The second seems to be adding them to your main layout (which creates them at app startup).
I decided to go with option #2 - for a couple reasons. (First, it was easier for me to get started by putting them in the XML layout, and because I had some problems trying to get the code to work. Second, one of the fragments uses the Google Maps Fragment, which apparently causes some issues adding/removing the fragments programmatically.(which was causing the errors just mentioned. Third, using the Location service, one of my fragments can read the GPS status from the other, without having to start the service up, wait for a location, and then shut it down.)
And so far, loading the fragments this way seems to work well. Only have one 'glitch' I'm wondering if I'm stuck with, or can work around -
When the app loads, I get the main activity layout, and the screen jumbles all around as the three or four fragments are loaded. Is it possible to somehow hide the messy UI display as fragments are loaded? If I create a splash activity, the fragments don't get loaded until the main activity layout is shown anyways, so that doesn't seem to help the problem any.
Any thoughts are welcome!
-Mike.,
coyttl said:
Hey Guys -
This is probably answered somewhere, but for some reason search isn't working at the moment.
So, first, keep in mind that I'm NOT an experienced developer - I have ONE app on the Play Store, and I learned both Java and Android through trial and error and more Google/DuckDuckGo searches than *they* are probably even aware of. When I first released my app, v2.3 or some such was the latest out. :laugh:
So now I'm working on bringing it into the new generation, and playing with fragments.
I've seen two main approaches with them - the first seems to be creating the fragments on the fly in code, as needed. The second seems to be adding them to your main layout (which creates them at app startup).
I decided to go with option #2 - for a couple reasons. (First, it was easier for me to get started by putting them in the XML layout, and because I had some problems trying to get the code to work. Second, one of the fragments uses the Google Maps Fragment, which apparently causes some issues adding/removing the fragments programmatically.(which was causing the errors just mentioned. Third, using the Location service, one of my fragments can read the GPS status from the other, without having to start the service up, wait for a location, and then shut it down.)
And so far, loading the fragments this way seems to work well. Only have one 'glitch' I'm wondering if I'm stuck with, or can work around -
When the app loads, I get the main activity layout, and the screen jumbles all around as the three or four fragments are loaded. Is it possible to somehow hide the messy UI display as fragments are loaded? If I create a splash activity, the fragments don't get loaded until the main activity layout is shown anyways, so that doesn't seem to help the problem any.
Any thoughts are welcome!
-Mike.,
Click to expand...
Click to collapse
what do you mean with "jumbles "? Loadinganimation? If not, use LoaderManager.LoaderCallbacks
Could you please post your layout file? The one you put the <fragment> tags into.
mynote said:
what do you mean with "jumbles "? Loadinganimation? If not, use LoaderManager.LoaderCallbacks
Click to expand...
Click to collapse
More like you can see each of the fragments load, in order, overlaying each other (especially in cases where I don't specifically set the background, leaving it transaprent, I guess..) In code, then as the first 'fragment' is selected, my code hides the unused one, 'cleaning up' the display. I can't grab a screenshot, since it happens in under half a second.
nikwen said:
Could you please post your layout file? The one you put the <fragment> tags into.
Click to expand...
Click to collapse
Oh, sure -
Code:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<fragment
android:id="@+id/fragment_map"
android:name="com.tsqmadness.bmmaps.views.MapPageFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top" >
<!-- Preview: [email protected]/fragment_mapscreen -->
</fragment>
<fragment
android:id="@+id/fragment_stations"
android:name="com.tsqmadness.bmmaps.views.StationsPageFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top" >
<!-- Preview: [email protected]/fragment_stations -->
</fragment>
<fragment
android:id="@+id/fragment_sheet"
android:name="com.tsqmadness.bmmaps.views.DatasheetPageFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top" >
<!-- Preview: [email protected]/fragment_mapscreen -->
</fragment>
</FrameLayout>
I could go back to creating them all in code, but.. before I do that was wondering if there was anything I overlooked.
Thanks!
-Mike.
coyttl said:
More like you can see each of the fragments load, in order, overlaying each other (especially in cases where I don't specifically set the background, leaving it transaprent, I guess..) In code, then as the first 'fragment' is selected, my code hides the unused one, 'cleaning up' the display. I can't grab a screenshot, since it happens in under half a second.
Oh, sure -
Code:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<fragment
android:id="@+id/fragment_map"
android:name="com.tsqmadness.bmmaps.views.MapPageFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top" >
<!-- Preview: [email protected]/fragment_mapscreen -->
</fragment>
<fragment
android:id="@+id/fragment_stations"
android:name="com.tsqmadness.bmmaps.views.StationsPageFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top" >
<!-- Preview: [email protected]/fragment_stations -->
</fragment>
<fragment
android:id="@+id/fragment_sheet"
android:name="com.tsqmadness.bmmaps.views.DatasheetPageFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top" >
<!-- Preview: [email protected]/fragment_mapscreen -->
</fragment>
</FrameLayout>
I could go back to creating them all in code, but.. before I do that was wondering if there was anything I overlooked.
Thanks!
-Mike.
Click to expand...
Click to collapse
Ah, thanks.
So you want one Fragment being at the front and all others behind it?
Then to hide them all during loading, you could put another View to the top (with android:width and height = "fill_parent"). As soon as all fragments have loaded, you can remove it.
Does that do what you want?
nikwen said:
Ah, thanks.
So you want one Fragment being at the front and all others behind it?
Then to hide them all during loading, you could put another View to the top (with android:width and height = "fill_parent"). As soon as all fragments have loaded, you can remove it.
Does that do what you want?
Click to expand...
Click to collapse
i prefer (this is what i do) replacing it after everything has been loaded. Means, use a framelayout or whatever and just replace it with the fragments, ist not that hard.
i can Show you an example if you want to
nikwen said:
Ah, thanks.
So you want one Fragment being at the front and all others behind it?
Then to hide them all during loading, you could put another View to the top (with android:width and height = "fill_parent"). As soon as all fragments have loaded, you can remove it.
Does that do what you want?
Click to expand...
Click to collapse
I'll give that a try! Essentially, I just want to hide all the apparent 'loading' of widgets until everything IS loaded, to clean up the launch process. (Obviously, this action does NOT happen if the app is in the background and brought forward - only on fresh launches - i.e. After being killed, or phone reboot.)
I hadn't thought of creating a fourth view in front of everything to hide them - I will try that. I don't see why it wouldn't work. I'll let you know tomorrow!
mynote said:
i prefer (this is what i do) replacing it after everything has been loaded. Means, use a framelayout or whatever and just replace it with the fragments, ist not that hard.
i can Show you an example if you want to
Click to expand...
Click to collapse
I wouldn't mind seeing some code, either. (Since I 'taught myself', I really do enjoy seeing other ways - usually better and quicker - at doing things. :laugh
Thanks guys -
Mike.
http://www.vogella.com/articles/AndroidFragments/article.html
scroll down, there is an example how to replace placeholder with fragments. you can receive broadcasts when the Fragment is done and replace it then this way
---------- Post added at 09:44 PM ---------- Previous post was at 09:43 PM ----------
http://www.vogella.com/articles/AndroidFragments/article.html
scroll down, there is an example how to replace placeholder with fragments. you can receive broadcasts when the Fragment is done and replace it then this way
mynote said:
http://www.vogella.com/articles/AndroidFragments/article.html
scroll down, there is an example how to replace placeholder with fragments. you can receive broadcasts when the Fragment is done and replace it then this way
---------- Post added at 09:44 PM ---------- Previous post was at 09:43 PM ----------
http://www.vogella.com/articles/AndroidFragments/article.html
scroll down, there is an example how to replace placeholder with fragments. you can receive broadcasts when the Fragment is done and replace it then this way
Click to expand...
Click to collapse
I just saw these exercises: http://www.vogella.com/articles/AndroidFragments/article.html#tutorial_dyanmicfragments
Did I miss anything?
nikwen said:
I just saw these exercises: http://www.vogella.com/articles/AndroidFragments/article.html#tutorial_dyanmicfragments
Did I miss anything?
Click to expand...
Click to collapse
No. That's true. You just have to use some way to get informed when the cursorloader is finished.
This should be that hard. Use a "Harcoded" Loading layout instead of Fragment and as soon as you get a notify (broadcastreceiver, fragmentmanager, whatever) then you "visible" replace the Fragment
mynote said:
No. That's true. You just have to use some way to get informed when the cursorloader is finished.
This should be that hard. Use a "Harcoded" Loading layout instead of Fragment and as soon as you get a notify (broadcastreceiver, fragmentmanager, whatever) then you "visible" replace the Fragment
Click to expand...
Click to collapse
If I ever need this, I'll be able to do that. Just wondering where the code was. :laugh:
Okay, so you guys lost me going back and forth in the last few messages there. (Not your fault, again, remember, I taught myself and am slow. )
However, an update on some things I tried:
Adding a view to overlay the other fragments does NOT work, unfortunately:
If added in the layout before the fragments, the view is created first, but then is underneath the fragments, defeating the purpose, because of Z-Order.
If the layout view is AFTER the fragments, it's now on top of the other fragments, BUT, because the other fragments are loaded first, you still see the stacked and loading views of the fragments before the final overlay view pops into the window.
My next thought was to mark the containing views IN each fragment's layout set to android:visibility="None". This didn't work either, as I had to set them Visible before using the FragmentManager.beginTransation() to enable/disable the fragments. Setting them all to 'visible' cause the loading animations to not appear, but all three fragments end up visible for a split second before the Transaction hid/showed the right fragments.
I looked at - am still looking at - that link with the code, but I think because one of my fragments HAS a fragment IN it (sub Fragment?) it will cause the same problems I ran into at the start of the project when I tried to create the fragments programatically.
I have one more little trick to try with the visibility of the views in the fragments, before I jump back to getting it all done up in code to avoid the ugliness.
Thanks guys -
Mike
Hi everyone! I'm new in this forum but I have to admit that I have read it a couple of times to see great stuff!
I read this thread because I had the same question. The answers here are the first thing in mind when I had the problem. As I searched the web, I found a library called Progress Fragment by Evgeny Shishkin.
https:/ /github.com/johnkil/Android-ProgressFragment (I'm new so I can't post links for now, so you can copy/paste it )
One of the main features is that is compatible with devices using Android 1.6 and up!
It's really easy to use!
I hope this helps someone.
Guys -
Thanks for your help.
After working around, here's what I ended up with -
I can't create and attach (.replace) the fragments programatically, since one of the fragments has a MapFragment inside of it. (NOT a MapSupportFragment). This causes the .replace to need some overriding to handle a 'sub-fragment'.
Seeing as I found a good way to handle it - I decided not to override the .replace or the fragment manager. Instead, my main activity (posted earlier in the thread), I made all three fragments visibility:gone. This allows the main activity to launch to a blank (or set background) screen briefly before loading up the first fragment and hiding the others.
When I call my fragmentmanager() to show/hide the fragments, I simply set the visibility to 'view' at the same time. Seems kinda clunky, but it works well.
Thanks!
-Mike.
When I go to view a video from a webpage or a news app I am always presented with a list of potential players (some of which I don't even have). I check the little box at the bottom of the list that says "always use this" or whatever, and then select RockPlayer. It all works fine but the Nook doesn't seem to remember this choice. It asks each time. Very annoying.
Does anyone know where this default app information is stored? A database file I could look at perhaps? Maybe something is not being set properly. I've made other default selections for other situations and they seem to take. Or maybe it's a RockPlayer issue?
<preferred-activities> inside /data/system/packages.xml
Always in the last place I look
So... this is what is there, but it's repeated over and over (and over--like for every time I've done it):
Code:
<preferred-activities>
<item name="com.redirectin.rockplayer.android.unified/com.redirectin.rockplayer.android.OpenRockPlayerActivity" match="600000" set="5">
<set name="com.estrongs.android.pop/.app.BrowserDownloaderActivity" />
<set name="com.estrongs.android.pop/.app.PopVideoPlayerProxyActivity" />
<set name="com.opera.browser/com.opera.Opera" />
<set name="com.alensw.PicFolder/.StreamingActivity" />
<set name="com.redirectin.rockplayer.android.unified/com.redirectin.rockplayer.android.OpenRockPlayerActivity" />
<filter>
<action name="android.intent.action.VIEW" />
<cat name="android.intent.category.DEFAULT" />
<type name="video/mp4" />
</filter>
</item>
I don't see the BBC News app mentioned in a similar vein, but it behaves in exactly the same way. Nothing in the code above jumps out at me as a novice, but the fact that there are many, many entries in the file all the same does not seem good.
Ideas?
Well, the easiest solution is to just gut the preferred-activities:
Code:
<preferred-activities>
</preferred-activities>
Your Nook may ask you once about a few intents, but that should be it.
It's possible that packages.xml got corrupted.
Also, depending on how a file gets opened there may be different filters for mimetype vs. path filters.
If you are still having problems, narrow it down to exactly how you are trying to open the file.
Use logcat and see what intent generates the picker dialog.