Android :: Intent.ACTION_VIEW For Png Not Working

Aug 5, 2009

I have an image file on my sdcard and the path to the file is: /sdcard/apps/MyPath/1249487966270.png

When a user clicks a button on my application I want to display this image to the user. Inside of the click listener I'm using the following code:

CODE:........

The button click event happens, the activity is started and then it is ignored. Nothing appears!

Watching the log through DDMS I see the following entries:

CODE:...........

What am I doing wrong? Why am I getting "Window already focused"? I want to use the default activity for viewing the image (the camera's ViewImage class). But this is not working.

Android :: Intent.ACTION_VIEW for png not working


Android :: Modified ACTION_VIEW Intent?

Jul 15, 2010

I execute the following code:

CODE:....................

Which opens the image viewer activity but I don't want to see the navigation arrows as well as the items in the menu. I only want the zoom controls. Is it possible to have it like that ?

View 2 Replies View Related

Android :: Returning From HTTP Intent.ACTION_VIEW

Mar 23, 2009

I have an application that needs to have a user visit a web page to authorize it. After spending time in the Browser the user should return the my application.

Currently, I'm launching the Browser with:

CODE:................

After using the browser, I can go back home and launch my application, which stacks a new Activity on top of the previous stack of Activities that were being used in the application. For example. If the user launches the app, they have Activity A in the stack. From there we navigate to Activity B which then launches the Browser. Then, the next time we enter the app, we launch Activity A, which is pushed onto the stack that already contains an A and B.

My question is then, how can I just go back to the previous stack? Basically, do I have to create a new Activity? Is there a better way to launch the Browser, and then come back to my application?

Also, I've been using the Intent.FLAG_ACTIVITY_NEW_TASK when I start the Browser activity so that my app stays running.

View 2 Replies View Related

Android :: ACTION_VIEW Exception ?

Sep 22, 2010

I try and open up a new activity, pointing to the market, with the following code:

CODE:......

It works fine on the device, but the Emulator throws an Exception:

CODE:....

I'm not sure if this is just an emulator thing, or whether this could replicate on a real device?

View 4 Replies View Related

Android :: Multiple Images Using ACTION_VIEW

Nov 13, 2009

I have a folder on sd-card in which I keep photos edited in my application. Im trying to force deafult android image viewer to see all pictured in that folder. Unfortunately I am able to see only one picture. The "next" and "previous" arrows are disabled.

The code i use to see only one picture:

CODE:.....

How to activate the browsing option? how to call the intent so that every picture in that folder would be visible?

View 2 Replies View Related

Android :: Start ACTION_VIEW With Memory Data

Oct 9, 2009

I would like to run an ACTION_VIEW with memory data.

The first solution is to write data in a file on sdcard but ... it does not seem so efficient. I was thinking to implement my own content provider, but as far as I understand I need to return an ParcelFileDescriptor. I found a MemoryFile implementation in SDK, however I don't know how to get a ParcelFileDescriptor for a MemoryFile.

View 2 Replies View Related

Android :: Difference Between ACTION_SENDTO And ACTION_VIEW When Sending Sms?

Jul 27, 2010

I have an application that sends messages to a specified contact. Right now I use

CODE:..............

To send messages, and it works great on the emulator and on my N1. I got complaints from users with HTC incredible that they get force close from android.mms application when they use it. I did more digging and I see there are many ways for sending messages.

For example

CODE:........

And also

CODE:....................

They all seem to work exactly the same on the emulator and on my device, and I could not find anything official about the correct, generally supported way.

View 2 Replies View Related

Android :: ACTION_VIEW Sefaults No Application Installed For Mimetype

Jun 2, 2010

I have an app that downloads a pdf from a server and tries to open it with an itent:

Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); File file = new File(filepath+filename); intent.setDataAndType(Uri.fromFile(file), "application/pdf"); try { startActivity(intent); } catch (ActivityNotFoundException e) {

View 2 Replies View Related

Android :: LiveFolders Cursor-returned Intent Not Working

Apr 15, 2010

I'm trying to get a LiveFolder implementation working, but I can't seem to be able to. I'm able to create the ContentProvider and the items show up nicely. However, I can't seem to be able to return a proper Intent in the Cursor from my ContentProvider to launch my activity.

Relevant bits of my code:

CODE:.................

From the provider (this is how I create the Intent I pass in the LiveFolders.INTENT column):

CODE:...................

When I click on an item I get an "Application not installed on your phone" error. Logcat says:

CODE:..................

Basically, for some reason, the Intent I return in the cursor is passed as the data of the actual intent that it tries to fire, which has a VIEW action. Why is this happening?

View 2 Replies View Related

Android :: Launching Intent Not Working On Saved Image File

Jun 2, 2010

First of all let me say that this questions is slightly connected to another question by me. Actually it was created because of that. I have the following code to write a bitmap downloaded from the net to a file in the sd card:

// Get image from url
URL u = new URL(url);
HttpGet httpRequest = new HttpGet(u.toURI());
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
HttpEntity entity = response.getEntity();
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
InputStream instream = bufHttpEntity.getContent();
Bitmap bmImg = BitmapFactory.decodeStream(instream);
instream.close();

// Write image to a file in sd card
File posterFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Android/data/com.myapp/files/image.jpg");
posterFile.createNewFile();
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(posterFile));
Bitmap mutable = Bitmap.createScaledBitmap(bmImg,bmImg.getWidth(),bmImg.getHeight(),true);
mutable.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();

// Launch default viewer for the file
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(posterFile.getAbsolutePath()),"image/*");
((Activity) getContext()).startActivity(intent);

A few notes. I am creating the "mutable" bitmap after seeing someone using it and it seems to work better than without it. And I am using the parse method on the Uri class and not the fromFile because in my code I am calling these in different places and when I am creating the intent I have a string path instead of a file. Now for my problem. The file gets created. The intent launches a dialog asking me to select a viewer. I have 3 viewers installed. The Astro image viewer, the default media gallery (I have a milstone on 2.1 but on the milestone the 2.1 update did not include the 3d gallery so it's the old one) and the 3d gallery from the nexus one (I found the apk in the wild). Now when I launch the 3 viewers the following happen:

Astro image viewer: The activity launches but I see nothing but a black screen.
Media Gallery: I get an exception dialog shown "The application MediaGallery (process com.motorola.gallery) has stoppedunexpectedly. Please try again" with a force close option.
3D gallery: Everything works as it should.

When I try to simply open the file using the Astro file manager (browse to it and simply click) I get the same option dialog but this time things are different:
Astro image viewer: Everything works as it should.
Media Gallery: Everything works as it should.
3D gallery: The activity launches but I see nothing but a black screen.

As you can see everything is a complete mess. I have no idea why this happens but it happens like this every single time. It's not a random bug. Am I missing something when I am creating the intent? Or when I am creating the image file? As noted in the comment here is the part of interest in adb logcat. Also I should note that I changed the way I create the image file. Since I want to create a file that reflects an online file I simply download it instead of creating a Bitmap and then creating the file (this was done because at some point I needed the Bitmap but now I do it the other way around). The problems persist thought and are exactly the same:

I/ActivityManager(18852): Starting
activity: Intent {
act=android.intent.action.VIEW
dat=/sdcard/Android/data/com.myapp/files/image.jpg
typ=image/* flg=0x3800000
cmp=com.motorola.gallery/.ViewImage }
I/ActivityManager(18852): Start proc
com.motorola.gallery:ViewImage for
activity
com.motorola.gallery/.ViewImage:
pid=29187 uid=10017 gids={3003, 1015}
I/dalvikvm(29187): Debugger thread not
active, ignoring DDM send
(t=0x41504e4d l=38)
I/dalvikvm(29187): Debugger thread not
active, ignoring DDM send
(t=0x41504e4d l=64)
I/ActivityManager(18852): Process
com.handcent.nextsms (pid 29174) has died.
I/ViewImage(29187): In View Image
onCreate!
D/AndroidRuntime(29187): Shutting down VM
W/dalvikvm(29187): threadid=3: thread
exiting with uncaught exception
(group=0x4001b170)
E/AndroidRuntime(29187): Uncaught
handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(29187):
java.lang.RuntimeException: Unable to
start activity
ComponentInfo{com.motorola.gallery/com.motorola.gallery.ViewImage}:
java.lang.NullPointerException
E/AndroidRuntime(29187): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
E/AndroidRuntime(29187): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime(29187): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime(29187): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime(29187): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(29187): at
android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(29187): at
android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime(29187): at
java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(29187): at
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(29187): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(29187): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime(29187): at
dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(29187): Caused by:
java.lang.NullPointerException
E/AndroidRuntime(29187): at
com.motorola.gallery.ImageManager.allImages(ImageManager.java:5621)
E/AndroidRuntime(29187): at
com.motorola.gallery.ImageManager.getSingleImageListByUri(ImageManager.java:5515)
E/AndroidRuntime(29187): at
com.motorola.gallery.ViewImage.onCreate(ViewImage.java:1801)
E/AndroidRuntime(29187): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(29187): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
E/AndroidRuntime(29187): ... 11 more

View 3 Replies View Related

Android :: Alarm Manager For Multiple Pending Intent Are Not Working.

Aug 16, 2010

In my application i have created pending intent which calls another activity (after 20mins of alarm off) with the help of alarm manger. It should happen each time for each new pending intent or when I call that activity. But when i create one pending intent and after few mins again create new pending intent ,then the last one overlap the other previous pending intents and start specified activity only for ones for the last pending intent.I want that each time i create any pending intent it should start specified activity after 20 mins of it's alarm off time.How it can be done ?

View 7 Replies View Related

Android :: Launching My App Using Intent URI

Aug 25, 2010

I know this has been asked a lot of times in StackOverflow already, but I haven't quite found a solution yet. My app sends an email with a link in it that when clicked should launch the app. According to @hackbod, the best way to do it is to make use of the Intent URI (see this). Here's my code that sets the intent and puts it in the email body: Code...

View 1 Replies View Related

Android :: What Is Pending Intent?

Feb 17, 2010

Please clarify me What is Pending Intent with an example.

View 2 Replies View Related

Android :: What Pending Intent Is?

May 11, 2010

I am newbie to Android. I read the Android documents. Can anyone tell me what "Pending Intent" is?

View 1 Replies View Related

Android :: How To Extend Intent?

Oct 6, 2010

I am using the following code to play video..

View 4 Replies View Related

Android :: How To Determine Intent

May 12, 2009

I would like to know how can I determine the value to put in an ACTION tag in AndroidManifest....

We have some defined intent at http://developer.android.com/reference/android/content/Intent.html...... ok.

I tried to do some stuff with receiver. I found an example SMS_RECEIVED. This example work when I use android.provider.Telephony.SMS_RECEIVED in the action. If I try to find these constant in android.provider.Telephony I've a problem...It doesn't exist...So where is it defined?

View 2 Replies View Related

Android :: What Are Intent Filters Exactly

Jul 3, 2010

I've read lots of articles about intent filters and I really can't understand exactly what they do? so please if anybody can explain to me with a clear example what is the role of intent filters exactly ?

View 4 Replies View Related

Android :: What Are Intent-filters

Jul 23, 2010

In my android app, I wanted to start an activity 'B' from initial activity 'A'. I have created classes for both of these. However when using following code to start B, I get runtime error as application has stopped unexpectedly, try again.

CODE:..........

When I added a new entry in AndroidManifest.xml/manifest/application/activity/intent-filers for activity B then the application worked.

I have two questions:

When there are multiple activities entries in AndroidManifest.xml, how does android know which activity to start first?
I could not understand intent-filters.

Here is my partial AndroidManifest.xml

CODE:...................

View 1 Replies View Related

Android :: Intent - Return Value ?

May 25, 2009

I have an application that open an other class using intent :

CODE:.........

In Repository.class we have the onActivityResult method :

CODE:...................

I don't know how I can return the value of num to the first class (that create Repository.class).

View 2 Replies View Related

Android :: Intent URI To Go To Calendar App?

Aug 10, 2010

I would like to know if there is any URI or action to go to a calendar app loaded in the mobile.

The question is similar to http://stackoverflow.com/questions/3116147/intent-uri-to-go-to-favorite-contacts

View 2 Replies View Related

Android :: Ue Intent In Service?

Aug 3, 2010

I want startActivity in the service.first I new Intent(),but I don't know how to new Intent().Because Activity and Service don't together project.I don't know Intent how to find this Activity.

View 2 Replies View Related

Android :: Droid Sent Sms Intent?

Nov 7, 2010

I'd like to know which is the intent android sends when it sends a message. And how can I listen for this intent in my application. I wanted that, when I send a message in native android messaging, my application listen this intent, so it will know a new message has been sent.

So, which one is it, and how to listen for this intent?

View 2 Replies View Related

Android :: How To Close An Intent

Nov 5, 2010

Code...

i want to:

browserIntent.close or something... browserIntent.finish();? how to?

View 3 Replies View Related

Android : Way To Get Activity From An Intent?

Nov 2, 2010

Is it possible to get the Activity from an Intent?

View 2 Replies View Related

Android : Can I Pass Value Through Intent?

Aug 11, 2010

But the problem is i am getting a blank view.My view is not coming up with textview. is this proper to set background "DetailsTextView.setBackgroundResource"?

View 1 Replies View Related

Android :: Passing Intent Value To Another Class

Oct 14, 2010

I have four groups in a listview each with four url's I want to load in a webView. When the user select a url to goto I set a value like so;

if (position == 0) webb = webb +2;
{
Intent intent = new Intent(this, official.class);
startActivity(intent);
}

I then carryout the intent to move to the webView class where I have given each URL a value like so;

if (webb == 2) mWebView.loadUrl("http://yahoo.com");
if (webb == 3) mWebView.loadUrl("http://www.bbc.co.uk");

But the screen stays blank, if I state the value inside the official.class it works. How can I get this value to pass to another class based on the selection the user makes from the listview.

View 3 Replies View Related

Android :: Passing Intent Value From One Class To Another

Oct 16, 2010

I have been trying to get "getExtra" to work but without success, I have a listview with 4 choices which launch a webpage within a webView class, when the user selects the option lets say option 3 I want to pass the value of 3 to the webView class so that it will load the correct webpage, at the moment I get no errors, but the app force closes when I select the option, could this be due to having to announce this in the manifest? can somebody help with where I am going wrong. This is my intent

public void onListItemClick(ListView l, View v, int position, long id) {
if (position == 0) {
Intent intent = new Intent(this, official.class);
intent.putExtra("weburl", 3);
startActivity(intent);}
This is the official class:
public class official extends Activity {
int number = getIntent().getIntExtra("weburl", 0);
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
} return super.onKeyDown(keyCode, event);
} WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.browser1);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
if (number == 2) mWebView.loadUrl("http://bcafc.livewwware.co.uk");
if (number == 3) mWebView.loadUrl("http://www.bbc.co.uk");
mWebView.setWebViewClient(new HelloWebViewClient());

View 1 Replies View Related

Android :: UI Blocking On Intent Service?

Sep 14, 2010

I'm launching an IntentService using startActivity from inside the onClickListener of a button. startActivity returns immediately. No blocking there. But the button stays "pressed" until the IntentService finishes its work. In addition, the screen does not respond to rotation while the IntentService thread is running. I can see that it's a separate thread in the debugger but the UI seems to be coupled to it. As soon as the IntentService thread finishes, the UI is unblocked. Any idea how I can prevent this and let the UI continue?

View 2 Replies View Related

Android :: How To Access Intent Value In Another Class?

May 5, 2010

I had write two classes IntentA and IntentB in my application (Both are in same package and both extends Activity class). In IntentA class I had created one button on pressing that button controll is trsnfer to IntentB class. IntentB class also contain Button on pressing that control is transfer to IntentA class.

This work fines. Now I want to set value in IntentA class using putExtra method and access that value in IntentB class How should I do that? I had put value in class IntentA like

Intent i1 = new Intent(this,IntentB.class);
i1.putExtra("Intent Name", "IntentA");
startActivity(i1);

Now I don't know How to access "Intent Name" value in IntentB class.

View 5 Replies View Related

Android :: Intent And URI Conversion Result

Feb 14, 2009

We can convert from Intent to URI and from URI to Intent. From Intent to URI string Intent intent1 = new Intent ();
String uriString = intent1.toURI ();
From URI string to Intent Uri uri = Uri.parse (uriString);
Intent intent2 = new Intent ();
intent2.setData (uri)

After conversion, intent1 and inten2 should be same. for example:
Intent intent1 = new Intent ();
intent1.addCategory (Intent.CATEGORY_HOME);
intent1.addCategory (Intent.CATEGORY_LAUNCHER);
Log.v ("", "Intent1 = " + intent1);
if (intent1.hasCategory (Intent.CATEGORY_HOME))
Log.v ("Intent1", "#1 hasCategory TRUE");
else Log.v ("Intent1", "#1 hasCategory FALSE");
String str = intent1.toURI ();
Uri uri = Uri.parse (str);
Intent intent2 = new Intent ();
intent2.setData (uri);
Log.v ("", "Intent2 = " + intent2);
if (intent2.hasCategory (Intent.CATEGORY_HOME))
Log.v ("Intent2", "#2 hasCategory TRUE");
else Log.v ("Intent2", "#2 hasCategory FALSE");
result Intent1 = { categories=android.intent.category.HOME,android.intent.category.LAUNCHER} } #1 hasCategory TRUE

Intent2 {data=#Intent;
category=android.intent.category.HOME;
category=android.intent.category.LAUNCHER;
end } #2 hasCategory FALSE

In this sample code, Intent2 is a conversion result from Intent1. If you run this sample code, Intent1 result and Intent2 result are different. Because Intent1 and Intent2 have a same Intent.CATEGORY_HOEM, the result should be Intent1 and Intent2 is TRUE (intent.hasCategory). I think this is bug. And the hint is Intent1 and Intent2 's toString result is different.
Intent1 = {categories=android.intent.category.HOME,android.intent.category.LAUNCHER}
Intent2 = { data=#Intent;category=android.intent.category.HOME
category= android.intent.category.LAUNCHER;end }

I don't know how to convert Intent to URI(String) and convert URI (String) to Intent. I want to save Intent to DB and read Intent from DB.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved