开发者

Explicit Intent error

I want to new activity when i click an image. I already write activity android:name=.openPdf in manifestfile.

but it shows me an error:-

"android.content.ActivityNotFoundException: Unable开发者_开发技巧 to find explicit activity class {Parsing.this/openPdf.class}; have you declared this activity in your AndroidManifest.xml?
"

Code ::

iv1.setOnClickListener(new View.OnClickListener() 
            {
                public void onClick(View v) 
                {
                   // Toast.makeText(getApplicationContext(), "hello",Toast.LENGTH_SHORT).show();

                Intent pdf=new Intent(Parsing.this,openPdf.class);
                startActivity(pdf);

            }

        });


Please make sure like your activity which you are launching is in the same package, then and then you can write like android:name=.openPdf else need to use the full class name with package.


Actually you havnt register activity in your manifest file so to overcome that add activity tag and its Name in your Manifest file, like...

<activity android:name=".openPdf" />  // "." works as a package name


Instead of Parsing.this use getApplicationContext(); This may work. And instead of adding android:name=".openPdf" manually. Browse it in manifest application tag.

Cheers!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜