I have been trying to download some stuff from the internet in my app, but in the second activity. I have added the permission request, and it works in my first activity, but not in the second one? is there anything i'm forgetting? otherwise, why would i possibly be getting a permission error?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ruslan.seriesstuff">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<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>
<activity android:name=".Main2Activity">
</activity>
</application>
The problem occurred because of the newer version of android, in my case 6.0. I solved this problem by doing the following. Long press on the app icon in your phone, drag it to the appeared icon of app info. There go to the permissions of the app and make sure you have actually provided the permission to the internet. That's it!
Related
When first starting a simple app, usually the title of the app is on the top of the activity. However, for me, it says com.example.inventory.MainActivity and then when I switch activities to another one, it'll say com.example.inventory.AddProduct
This is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.inventory">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".ProductList"></activity>
<activity android:name=".AddProduct" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I'm a beginner so sorry if I forgot to include any other important file.
You need to add a label for your activity like this:
<activity android:name=".ProductList"
android:label = "Product Screen"></activity>
Replace Product Screen with the Title of your choice.
Do the same for all the other activities in the Manifest.xml
First off, I want to say that I'm a really inexperienced android programmer. I've never worked with android studio but I've decided to learn. I need to complete my final course project which is an android app that allows users to search and share their experiences with the world!
In the android gallery I want to add to that "Share" button, my app, which, when clicked, would redirect the user to the "Profile Fragment" with a button saying "Share to the world!". I know that this is possible as I have already seen some questions like this. The problem is, as I said, I am a little noob in this android programming. Can someone explain how can I resolve my problem is some detailed way?
Thanks in advance!
EDIT:
This is my manifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".LoginActivity"
android:screenOrientation="portrait"
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=".MainActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
/>
<activity android:name=".SplashActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
</application>
I am just starting with android and trying to alter my android manifext .xml file such that a particular activity is launched first. My code is as follows:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".CrimeListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".CrimeActivity">
</activity>
</application>
I have a CrimeListActivity java class which simply should display an empty activity. However, it continues to default to displaying the activity that was specified in the manifest originally. ( In this case, .CrimeActivity.
It's hard to be more specific without posting too much code so I'm hoping someone could give me a couple pointers on where to start poking around when issues like this arise.
Thanks!
My home page needs to show two buttons: login & register. The page Login Activity with both buttons should appear first, but only the register screen comes up.
I am very new to coding. So, please be nice :( I've been stuck on this for days.
Below is the AndroidManifest.xml. Can anyone spot what I am doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.thrd">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".RegisterActivity"></activity>
<activity android:name=".UserAreaActivity"></activity>
</application>
</manifest>
You manifest file is ok. Probably you have some logical errors in your code. In LoginActivity. So it launches RegisterActivity (probably in onCreate), instead of showing itself.
I have a problem with launching this app through menu. There is no problem when I start it using a different application that has permission. This is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.michael.dangerouslab" >
<uses-permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"/>
<permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"
android:protectionLevel="dangerous"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM">
<activity android:name=".DangerDanger" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="course.labs.permissions.DANGEROUS_ACTIVITY"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
Delete both occurrences of android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM" (one in <application>, one in <activity>).
Those say "no third-party app, including the home screen, can do anything with my app, unless they have <uses-permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"/> in their manifest". There are roughly zero apps that have such an element, including roughly zero home screen implementations. Hence, you will not be able to launch your app.