Arrange page priority - android

I started to create an android application. At first, I planned it will be 5 pages and I wrote Xml and java codes for the first page and the others. Now I realized I made a mistake. The first page can not be a first page. Means; there should be a new page before the first page. I wrote codes for that new page but I can't see it when I run the project. What should I do? Thanks already.

You have to add the activity to the AndroidManifest.xml
There you can specify which Activity should be the Launch-Activity by setting the intent-filter like:
<activity android:name="LaunchActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Be sure only your Launchy Activity has that intent signature though.
No offense, but that's pretty basic knowledge, maybe you should read a few tutorials before jumping into development?

Related

How to remove the Android notification bar/panel easily?

I want to remove the Android notification bar/panel (in my original post I said service bar) at the top of the screen when you swipe down. I have read multiple questions but can't find the solution in an easy explanation. I want to use it for kiosk mode. Can someone help me out and explain where I have to add the code.
Thanks!
EDIT: I found this question on the website: Disable the notification panel from being pulled down
i want to know which code i can add and where in android studio.
You mean the "ActionBar"?.
You can remove "ActionBar" by adding "android:theme="#style/AppTheme.NoActionBar" to the Activity tag in AndroidManifest.xml like below.
<activity
android:name=".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>

How to hide an app in the Application Manager

I want to make my Android application invisible and work through a background task.
This part should work like these two apps, if anyone knows them:
https://www.keeperschildsafety.net/
https://www2.mspy.com/
I already found examples for making the app icon invisible, but I want to go one step further.
This is the site I found that on:
https://readyandroid.wordpress.com/hideunhide-app-icon-programmatically-android/
I also found some explanations that I should delete the <intent-filter>:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
But then I am not able to start my application.
On all other sites I read that this is not possible, but the two examples shown at the top prove that it is actually possible somehow.
I want to start my application once, then hide it and unhide it later.
I already know how to trigger the unhide. The only part that I need is the hiding and unhiding itself.
You need to remove the following line from your AndroidManifest.xml:
<category android:name="android.intent.category.LAUNCHER"/>
This will remove the application from the default launcher. However, you also need to add the following line such that your BroadcastReceiver is not completely ignored:
<category android:name="android.intent.category.DEFAULT"/>
You should NOT remove the line below - it is used to specify which Activity should launch first when your app is opened:
<action android:name="android.intent.action.MAIN"/>
also try this
<activity android:name=".MainActivity"
android:excludeFromRecents="true" ...
in your AndroidManifest.xml's activity declaration.

Launch app using an intent URI (and making that URI show up as link in other apps)

I know this has been asked before, and I have looked through a lot of those questions, but none seems to hold the answer for me.
What I am trying to do is to open my app when I click a link, which in my case would look like dots://test.com/. I'm trying to get this working through intents. When I replace dots:// with http:// and use http in my scheme instead of dots, it works fine. But since the only domains I own have got pretty long urls, it's not practical to go that route.
My android manifest looks like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:logo="#drawable/logo"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="ADMOB_ALLOW_LOCATION_FOR_ADS"
android:value="true" />
<activity
android:name="nl.delta6.dots.engine.MainActivity"
android:exported="true"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="dots" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
I have tried numerous solutions mentioned in posts like Make a link in the Android browser start up my app? and Launch android application from a browser link, but none seem to work for me. All ideas are welcome.
Edit 1:
Okay, so I noticed that if I click a link on a webpage like dots link, it does launch my app. The links just don't show as links in other apps, though I know that is possible. I'll keep looking around, but if there's anybody who could send me off in the right direction that'd be more than welcome.
I think the best article is here: Make a link in the Android browser start up my app?
Note that you really want to use hackbod's recommendation, which means that registering the scheme "dots" to yourself is not a good idea. The easiest way to create a link that a browser can use is to first, in a test setting, have your intent format itself to a uri:
Intent intent = new Intent(someContext, MainActivity.class)
System.out.println[or use logcat](intent.getUri());
Then just paste the output from intent.getUri() as a url. It will look something like:
intent:#Intent;component=[your/activty/class/NameActivity;]
If you serve that as a link on a website, connect to it on your phone with your app installed and click the link it should then open your app.
Note that you can also add "extras" to your activity using putExtra if you want to see example intent uris that can be used to send extra data back to your app.

Why does one package declare another's activity in its own manifest?

As indicated by the tags, this is homework/classwork. (Note that it's really just an in class thing that my instructor can't seem to explain, so I'm turning to the interwebs).
We have an example made up of two apps: Sample1 and Sample2. The point of the example is to show calling into Sample2 from Sample1 using an intent. Sample 2 uses an intent filter to be launched by a certain intent. Here is a snipped from the manifest.
<activity
android:name=".Sample2"
android:label="#string/title_activity_Sample02" >
<intent-filter>
<action android:name="Sample02.intent.action.Thinger" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Sample01 invokes this using an intent:
Intent intent = new Intent("Sample02.intent.action.Thinger");
startActivity(intent);
This works fine, assuming that Sample02 is installed on the target device.
What confuses me is this bit in Sample01's manifest file:
<activity
android:name="com.example.Sample02.Sample02"
>
</activity>
I don't understand what this is for. It exists in addition to the declaration for Sample01 in the same file. Near as I can tell, I can remove it and everything works the same. Anyone know what this about? Thanks.
This is acknowledgment of simple02 app in simple01 app manifest. it is showing that we want to use simple02 method and function in simple01 app.

How can I create a "Launcher" Activity programmatically?

Instead of declaring a pre-determined launcher activity in my manifest using an intent filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Could I, instead, be given programmatic control over the activity which gets run when the application launches?
I'm not able to find anywhere in the documentation which says I must use the intent filter approach... but I also don't see any discussion of the alternative(s).
http://developer.android.com/guide/topics/fundamentals/activities.html
http://developer.android.com/guide/topics/intents/intents-filters.html
Thanks.
As far as I know, it's not possible. Android creates or sets up the hard link of the App icons to their respective activities by looking at the manifest. If you don't set it, you will not find any icons/shortcuts for your app after you install it.

Categories

Resources