No Activity found to handle Intent, Android - android

I am developing a project on Android that deals with images either from the camera or from the sd-card. I had this working fine until earlier I was fiddling with the code and broke it. It was too late to undo and I can't seem to find the solution.
After the image is selected and processed, a list should be returned but now I get an Activity not Found exception, here is a picture.
If anybody has any idea whats going on I'd appreciate it!
EDIT
Just got it, was a silly mistake, I had
Intent intent = new Intent(Results)
Instead of
Intent intent = new Intent(this, Results.class)

It was a silly mistake, I had
Intent intent = new Intent(Results)
Instead of
Intent intent = new Intent(this, Results.class)

Try adding "" to the calling Activity.

Related

Calling startActivity from my app to return to Pokemon Go causes Pokemon Go to restart

I'm wondering if there is another way to switch to a different app? The built-in task switcher doesn't cause Pokemon Go to restart. Is there a way to invoke that?
I have been using this to switch from my app and open Pokemon Go
PackageManager manager = context.getPackageManager();
Intent intent = manager.getLaunchIntentForPackage("com.nianticlabs.pokemongo");
intent.addCategory(Intent.CATEGORY_LAUNCHER);
A few months ago, this started Pokemon Go to open to a black screen. The workaround for this was to close Pokemon go, and start Pokemon Go by switching to it through my app. The first time would start with Pokemon Go's loading screen as expected, but would properly switch between apps after that.
The latest release of Pokemon Go seems to have fixed the black screen problem by always restarting Pokemon Go everytime it is switch to. I found this other intent filter in their AndroidManifest.xml and it works, but it also causes the app to restart.
Uri uri = Uri.parse("http://pokemongolive.com/launchapp");
Intent pokemonGoIntent = new Intent(Intent.ACTION_VIEW, uri);
if (pokemonGoIntent.resolveActivity(getPackageManager()) != null)
startActivity(pokemonGoIntent);
Is another way to switch to another app? Even when my app is loaded and running, the built-in task switcher doesn't cause Pokemon Go to restart.
I finally managed to find a solution, after a whole day of testing.
It works for me:
Intent poGoIntent = activity.getPackageManager().getLaunchIntentForPackage("com.nianticlabs.pokemongo");
poGoIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
activity.startActivity(poGoIntent);
Let me know if it helps!
After taking a look at some log files, I saw some suspicious messages. I found the corresponding API calls and this seems to be working for me.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(new ComponentName("com.nianticlabs.pokemongo", "com.nianticproject.holoholo.libholoholo.unity.UnityMainActivity"));
intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
startActivity(intent);

Error in Intent - Android Studio

I'm trying to modify vuforia's sample videoplayback application in Android Studio. In that sample app, video will be played whenever targeted image is focused. I try to modify like I want to go next activity when the video is played fully. So I just used Intent, but it will throw and error as "Cannot resolve constructor Intent". Here I have attached screenshot of the error.Can you guys please help me to resolve this issue. Thanks in advance.
Screenshot of the error VideoPlayerHelper imports
Intent intent = new Intent(this, SearchResult.class);
"this" should be context or child's context.
Intent intent = new Intent(type of context, SearchResult.class);
This is just a class you need to pass the context to the class(passing through constructor would be better). Then do following:
Intent intent = new Intent(context,SearchResult.class);
and better way is create listeners(interface) and call appropriate method on activity using them.
Try Intent intent = new Intent(VideoPlayerHelper.this,SearchResult.class);
Just change u're coding
Intent intent = new Intent(this,SearchResult.class);
to
Intent intent = new Intent(getIntent(),SearchResult.class);

How to start an Intent in Android

I just following a tutorial to start a basic intent, and I get an error. Doing exact the same as the tutorial, created an empty Activity and just passed as argument to the intent. What is the problem?
Using a video tutorial: Lynda.com - Developing Android Apps Essential Training (2015)
The error you've got in IDE usually happens when you try to use Activity Context (keyword this) inside some callback, listener or anonymous function. In such situation this does not refer to the Context of the Activity.
That's why solution provided by #Vishal Patoliya should fix your problem because you're explicitly referring to the Context of the concrete Activity as follows:
Intent intent = new Intent(YourActivity.this,ItemUserSettingRattingActivity.class);
Try this
Intent intent = new Intent(YourActivity.this,ItemUserSettingRattingActivity.class);
startActivity(intent);
In case of Activtiy, you are going to another activity:--
Intent intent = new
Intent(YourActivity.this,ItemUserSettingRattingActivity.class);
startActivity(intent);
If you are passing intent from a fragment to open a activity then
Intent intent = new Intent(getActivity(),ItemUserSettingRattingActivity.class);
startActivity(intent);
Have you already created a class named ItemUserSettingRattingActivity.java? maybe you get an error it's because the intent you created didn't detect the class.

Which is the correct way to start an Activity?

Let's say the Activity I want to start is named "OccupyThePieShop"
I was previously using this methodology to start an Activity:
Intent oTPS = new Intent();
timeIntervalConfigIntent.setClassName("com.aXX3AndSpace.KeepInTouch",
"com.aXX3AndSpace.KeepInTouch.OccupyThePieShop");
startActivity(oTPS);
...but was told that this is more the norm:
Intent oTPS = new
Intent(KeepInTouchActivity.this, OccupyThePieShop.class);
KeepInTouchActivity.this.startActivity(oTPS);
...and so I replaced my calls to startActivity() with that usage.
Now, I've come across a couple more ways which seem quite "elegant," namely:
startActivity(new Intent(getApplicationContext(), OccupyThePieShop.class));
...and:
Intent intent = new Intent(this, OccupyThePieShop.class);
startActivity(intent);
Is one way preferred over the others, and if so, why?
I think this is probably an issue of personal preference. I like startActivity(new Intent(this, OccupyThePieShop.class)); because, as you said, it is elegant.

android linkify intent

I have a ListView that uses Linkify to create a link to another activity in my app. the url looks something like content://com.myapp/activitiy/view?param=blah
this works fine every time.
however, in another view, I'm trying to call some code like this:
Intent i = new Intent("content://com.myapp/activity/view?param=blah");
i.setAction(Intent.ACTION_VIEW);
startActivity(i);
but for some reason this doesn't seem to work. It doesn't trigger my activity (and in fact it blows up if i dont include the setAction() call. How am I supposed to create the Intent such that it acts the same way that Linkify does...?
Now i realize i can setup the extras and then handle it in the activity, but that just seems like duplicated effort. So instead i'll spend the time it would have taken to do that, and post this question. SO any help much appreciated. :)
ah. just figured it out:
String uri = "content://...";
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(i);

Categories

Resources