How can you get the build/version number of your Android application?

If you’re using the Gradle plugin/Android Studio, as of version 0.7.0, version code and version name are available statically in BuildConfig. Make sure you import your app’s package, and not another BuildConfig: import com.yourpackage.BuildConfig; … int versionCode = BuildConfig.VERSION_CODE; String versionName = BuildConfig.VERSION_NAME; No Context object needed! Also make sure to specify them in your … Read more

Android – Adding at least one Activity with an ACTION-VIEW intent-filter after Updating SDK version 23

From official documentation : To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest. These intent filters allow deep linking to the content in any of your activities. For example, the user might click … Read more

How to change an Android app’s name?

Yes you can. By changing the android:label field in your application node in AndroidManifest.xml. Note: If you have added a Splash Screen and added <activity android:name=”.SplashActivity” android:label=”@string/title_activity_splash_screen” android:theme=”@style/AppTheme”> <intent-filter> <action android:name=”android.intent.action.MAIN” /> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.LAUNCHER” /> </intent-filter> </activity> to your Splash Screen, then the Launcher Icon name will be changed to the name … Read more

Error type 3 Error: Activity class {} does not exist

I faced a similar problem after refactoring. This is what i did to resolve this issue: Cleaned the Project Deleted the Build directory Restarted Android Studio Rebuild the Project Run Optionally (Go to the files menu on android, click on “Invalidate Caches / Restart…” uninstall the app on your phone and try again) And everything … Read more

How to add manifest permission to an application?

Assuming you do not have permissions set from your LogCat error description, here is my contents for my AndroidManifest.xml file that has access to the internet: <manifest xlmns:android…> … <uses-permission android:name=”android.permission.INTERNET” /> <application … </manifest> Other than that, you should be fine to download a file from the internet.

How can I disable landscape mode in Android?

Add android:screenOrientation=”portrait” to the activity in the AndroidManifest.xml. For example: <activity android:name=”.SomeActivity” android:label=”@string/app_name” android:screenOrientation=”portrait” /> Since this has become a super-popular answer, I feel very guilty as forcing portrait is rarely the right solution to the problems it’s frequently applied to. The major caveats with forced portrait: This does not absolve you of having to … Read more

How can you get the build/version number of your Android application?

If you’re using the Gradle plugin/Android Studio, as of version 0.7.0, version code and version name are available statically in BuildConfig. Make sure you import your app’s package, and not another BuildConfig: import com.yourpackage.BuildConfig; … int versionCode = BuildConfig.VERSION_CODE; String versionName = BuildConfig.VERSION_NAME; No Context object needed! Also make sure to specify them in your … Read more

techhipbettruvabetnorabahisbahis forumu