image of the offending pointer:
http://i842.photobucket.com/albums/zz347/oxygen_addict/bugs/device.png
the problem is that this pointer shows up whenever I transition from one activity to another.
code of the intent's:
final Intent intent = new Intent(ActivityTwo.this, test.app.com.ActivityOne.class);
startActivity(intent);
final Intent intent = new Intent(ActivityOne.this, test.app.com.ActivityTwo.class);
startActivity(intent);
Manifest:
<!-- LAUNCH ACTIVITY -->
<activity android:name=".ActivityOne"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- SUB-ACTIVITIES -->
<activity android:name=".ActivityTwo"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:noHistory="true"
android:theme="#android:style/Theme.NoTitleBar" />
Note:
within onCreate() of each activity I am using
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
How can I get rid of the pointer ?
FYI: the OS has to be rebuilt to remove the pointer.
Would have been awesome to have an Application-level API available to control it....
Related
I'm trying to start an activity in another package, I already saw a lot of answers on the topic, but the answers I found don't seem to work for me.
Here how I call the other activity:
Intent intent = new Intent();
intent.setClassName("com.packageroot.package2", "com.packageroot.package2.MainActivity");
context.startActivity(intent);
And here my Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.packageroot" >
<application
<activity
android:name=".package1.MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.packageroot.package2.MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/AppTheme"
android:parentActivityName=".package1.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".package1.MainActivity"/>
</activity>
And I still get this error:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.packageroot.package2/com.packageroot.package2.MainActivity}; have you declared this activity in your manifest?
What I don't get is that the path indicated is the error is exactly the name of the activity...
Thanks a lot in advance.
You could try adding the package to the build.gradle file under dependencies:
dependencies {
compile 'com.packageroot.package2'
}
change this line:
intent.setClassName("com.packageroot.package2", "com.packageroot.package2.MainActivity");
to
intent.setClassName("com.packageroot", "com.packageroot.package2.MainActivity");
The first parameter is "package name".
http://developer.android.com/reference/android/content/Intent.html#setClassName%28java.lang.String,%20java.lang.String%29
If your intent go through packages,this is what you should do.
In your Manifest
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:exported="true">//got to declare this
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="YOUR ACTION NAME" />
//At least one category,use DEFAULT if you don't have one
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
And in your Activity
Intent intent = new Intent();
intent.setAction(YOUR ACTION NAME);
intent.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(intent);
Best Solution Work for me is controlling the back Button
#Override
public void onBackPressed() {
Intent intent = new Intent(CurrentActivity.this, SecoundActivity.class);
startActivity(intent);
finish();
}
I have two activities in my application. SplashActivity and MainActivity. Here is their manifest definition.
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".SplashActivity"
android:label="#string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I want to finish SplashActivity after it shown , as you see it is defined as noHistor and calling MainActivity after 10 seconds so ;
Intent a = new Intent(this,MainActivity.class);
a.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(a);
finish();
When i take application to background and trying to resume , it is not resuming from MainActivity , it shows SplashActivity again.. how can i prevent this ? is it a known bug ?
Thank you very much
Activity A start muzic player(B) with intent, going back from music player shows the homescreen not activty A.
here is the acitvity in manifest
<activity android:name="myactivity"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and Intent to start muzic player
Intent i = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("file:///sdcard/"+"rec1.wav");
i.setDataAndType(uri, "audio/*");
startActivity(i);
Expected results: Going back from muzicplayer, activity A shall be visible as per activity life cycle.
Hi the problem is your android:noHistory="true"
please remove this from your XML.
<activity android:name="myactivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
hope this might be help you.
Intent intent = new Intent();
intent.setClassName("another_app_package_name","another_app_package_name.class_name_in_that_package");
startActivity(intent);
getting ActivityNotFoundException ?
How to solve this problem? This problem posted earlier as well but no solution.I manifest file of application whose activity to be called i have used intent filter as well.
Activity to be called by some other application's activity
<activity
android:name="com.example.custompermission.PrivActivity">
android:permission="abc.permission.STARTMYACTIVITY">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
Check this
Intent intent = new Intent();
intent.setClassName(another_app_package_name.this,another_app_package_name.class_name_in_that_package.class);
startActivity(intent);
and in manifest.xml add this
<activity android:name="another_app_package_name.class_name_in_that__package" android:configChanges="orientation|keyboardHidden"></activity>
In manifest file you do like this:
<activity android:name="another_app_package_name.class_name_in_that__package"></activity>
you should add the activity in manifest file, which you are tried to called from first activity.
you need to add both the activities in manifest file:
for ex:
Intent intent = new Intent (HomePage.this, Second.class);
startActivity(intent);
in manifest: <application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".HomePage"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name =".Second"></activity>
</application>
Once, clean the project and run.
I keep getting "ActivityNotFoundException: Unable to find explicit activity class ... " when using Eclipse's emulator to call the activity of another application from an application. Perhaps the problem maybe related to I am not able to download to/find both applications at the same time when I click on "Manage Applications" in Settings. This is the first project I need to call the activity of another application. But I am not sure the code is correct either. Please help me determine if there are errors in the code snippets I present below. It is hinted that I can set the action field of the intent to achieve the objective but have not found learning material for this. I learned about using the setComponent method in the calling app and to add android:export to the called activity's AndroidManifest.xml. Thanks in advance!
Calling app's relevant source code:
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.MyPackage", om.MyPackage.Activity1));
startActivity(intent);
Calling app's relevant AndroidManifest.xml :
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity1">
<intent-filter>
<action android:name="com.MyPackage.Activity1" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
Relevant code of AndroidManifest.xml of the activity of another application
<activity android:name=".Activity1" android:exported = "true">
<intent-filter>
<action android:name="com.MyPackage.Activity1" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Firstly point out that you're trying to start Activity in Application2 from Activity in Application1
You have to give them separate namespaces
both applications now have com.MyPackage.* prefix
OR use names Activity1 and Activity2
So you will have
com.MyPackage1.Activity1
// and
com.MyPackage2.Activity1
Then you can use this code, to start Activity1 in MyPackage2 from MyPackage1.
// in file com.MyPackage1.Activity1
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.MyPackage2", "com.MyPackage2.Activity1"));
startActivity(intent);
And your AndroidManifest.xml files should look like this:
first
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="com.MyPackage1.Activity1"
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>
second
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="com.MyPackage2.Activity1"
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>
see related SO question:
How to start activity in another application?