live wallpaper-settings button is not working - java

okay, this is my very first application which i am working on, everything works fine until i wanted to add a settings button to my live wallpaper, the problem is, when i simply hit "settings" it comes with this message of "live wallpaper picker has stopped". here's my code
Android manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Live.zaki"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.ui.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme" >
/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
android:label="#string/appName"
android:icon="#drawable/icon">
<service
android:name="com.Live.zaki.CustomWallpaper"
android:label="#string/appName"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/wallpaper" />
</service>
<activity
android:name="com.example.ui.SecondActivity"
android:label="Home" >
</activity>
<activity
android:name=".PrefsActivity"
android:theme="#android:style/Theme.Black.NoTitleBar" >
</activity>
</application>
</manifest>
wallpaper.xml
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="#drawable/icon"
android:description="#string/appDescription"
android:settingsActivity="com.Live.zaki.PrefsActivity"
/>
prefs.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="#string/general_lwp_settings">
<CheckBoxPreference
android:key="lwp_o_scroll_lock_key"
android:summary="#string/lwp_o_scroll_lock_summary"
android:title="#string/lwp_o_scroll_lock_title"
android:defaultValue="false" />
<CheckBoxPreference
android:key="lwp_auto_animation_key"
android:summary="#string/lwp_auto_animation_summary"
android:title="#string/lwp_auto_animation_title"
android:defaultValue="false" />
</PreferenceCategory>
PrefsActivity.java
public class PrefsActivity extends PreferenceActivity{#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(com.Live.zaki.R.xml.prefs);
}
}
i haven't yet configured any preference logic on my main livewallpaper.java code, i just want that settings menu to popup "two checkbox in my case". Is this even possible ??
if anyone could help me, that would great !! tips, tutorials anything !!
here's my application results without settings,
https://drive.google.com/file/d/0B44QwXQHh5irNFRnYkhzdDhPM00/edit?usp=sharing

buddy add exported flag in setting activity and set it true android:exported="true"

change the package name in your xml folder wallpaper.xml file to a fully qualified name.
android:settingsActivity="yourPackagename.PrefsActivity"
in the Manifest file add:
<activity
android:exported="true"
android:name=".PrefsActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">

Related

Android Studio android:label for a differnet activity does not display the app name [does not work]

I am trying to have a different app name for an Activity "My Profile Photo" but it does not seem to show up even when I have given android:label="My Profile Pic" to that particular activity
The Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aditya.myprofile">
<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=".MainActivity"
android:label="My Profile">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ProfilePhoto"
android:label="Profile Pic" ></activity>
</application>
</manifest>
The XML Design:
The Android App name space is empty
Where am I going wrong?
Try this add title through java code add this code in your activity like this
getSupportActionBar().setTitle("My Profile");
I think you need to set a theme to your activity in your manifest.
<activity android:name=".ProfilePhoto"
android:theme="#style/AppTheme"
android:label="#string/profilePicture></activity>
Another solution : in your activity in onCreate you need to call :
getSupportActionBar().setTitle("Your Activity Title");

Its a way to cover the bar on the top or remove it?

Hello everyone i have a question can i remove this bar or cover it?
its anoying when i go back in the app it shows the bar, when i open the app then its normal.Can someone help me?
I searched around of the internet and i cant find any question about it to remove the tiny bar on the top.
When you can help me please write it down.
Here is the manifest code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.minecraft_pc.test">
<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="#android:style/Theme.NoTitleBar.Fullscreen">
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Try do it programmatically:
// as the doc page says, this is a solution for Android > 4.1
View view= getWindow().getDecorView();
int flagOption = View.SYSTEM_UI_FLAG_FULLSCREEN;
view.setSystemUiVisibility(flagOption);
You can check the relative doc page.

ActivityNotFoundException while using startActivity(Intent)

Here's the error, referring to where I call startActivity(Intent):
`05-17 01:40:37.918: E/AndroidRuntime(12997):android.content.ActivityNotFoundException:
Unable to find explicit activity class {/com.rhombi.Menu}; have you declared
this activity in your AndroidManifest.xml?
Here's how I use startActivity(Intent) in com.rhombi.Intro:
startActivity(iMenu);
Here's how I declare it earlier, in the same class:
public Intent iMenu = new Intent(this, Menu.class);
Here's how I declare it all in my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rhombi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<activity
android:name=".Intro"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Menu"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
I've searched through a TON of other questions about this and I can't seem to figure out what the issue is. The one thing that makes my issue unique is that little forward slash when it tells me that it's unable to find the explicit activity class ("{/com.rhombi.Menu}"). That never showed up in my searches, but I appear to be doing everything right.
There was something wrong with the this you passed as a Context to the Intent constructor, as evidenced by the empty package name in ComponentInfo {/com.rhombi.Menu} - there's just the class name.
try changing
android:name=".Menu" to android:name="{package name}.Menu"

"manifest" must be terminated by the matching end-tag "</manifest>"

I get the following error but there is no problem in my manifest file.
I tried changing my project name but I got this error once I changed my project name. help me solving this error without changing the project name back to the old one.
My old project name was "radio" my new project name is "Msurvey"
My error:
[2014-02-15 17:35:02 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for H:\radio\AndroidManifest.xml: The element type "manifest" must be terminated by the matching end-tag "</manifest>".
[2014-02-15 17:35:02 - radio] Error in an XML file: aborting build.
This is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.radio"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature android:glEsVersion="0x00020000" >
</uses-feature>
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/mobilesurvey"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.radio.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="com.example.radio.Res"
android:label="#string/title_activity_res" >
</activity>
<activity
android:name="com.example.radio.Admin"
android:label="#string/title_activity_admin" >
</activity>
<activity
android:name="com.example.radio.View"
android:label="#string/title_activity_view" >
</activity>
<activity
android:name="com.example.radio.View1"
android:label="#string/title_activity_view1" >
</activity>
<activity
android:name="com.example.radio.Answers"
android:label="#string/title_activity_answers" >
</activity>
<activity
android:name="com.example.radio.Data"
android:label="#string/title_activity_data" >
</activity>
<activity
android:name="com.example.radio.Food"
android:label="#string/title_activity_food" >
</activity>
<activity
android:name="com.example.radio.Service"
android:label="#string/title_activity_service" >
</activity>
<activity
android:name="com.example.radio.Services"
android:label="#string/title_activity_services" >
</activity>
<activity
android:name="com.example.radio.Places"
android:label="#string/title_activity_places" >
</activity>
<activity
android:name="com.example.radio.Adminmenu"
android:label="#string/title_activity_adminmenu" >
</activity>
<activity
android:name="com.example.radio.LoginActivity"
android:label="#string/title_activity_login"
android:windowSoftInputMode="adjustResize|stateVisible" >
</activity>
<activity
android:name="com.example.radio.FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_fullscreen"
android:theme="#style/FullscreenTheme" >
</activity>
<activity
android:name="com.example.radio.Adminlogin"
android:label="#string/title_activity_adminlogin" >
</activity>
<activity
android:name="com.example.radio.Report"
android:label="#string/title_activity_report" >
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
I tried all the similar questions in stackoverflow for this error but none solved my problem. Also all myactivities have their background changed to black as default from white. plz help me solve this color change mainly. Plz help me solve it.
It seems to pass XML validation. You said you did a clean, but what could possibly be the problem is that maybe you're modifying the wrong AndroidManifest.xml. (There are versions of it dynamically created in your bin and gen folders for instance). Check that you're modifying the AndroidManifest.xml in the topmost folder of your project.
remove the stating blank before xml-manifest, see The processing instruction target matching "[xX][mM][lL]" is not allowed
Also you need to place user-permission tags before appliction tag.
Regards,
Alex

Android Multi Window doesn't work when android:screenOrientation="portrait"

as the title says, when the next line of code
android:screenOrientation="portrait"
is entered in my Manifest file then when I start my app and, for example, dragging the gallery app to it then its not activating the multi window feature which splits the screen... but just replace my app with the gallery app, meaning the gallery app takes all the screen instead of taking only half of it.
If I first open the gallery app and then dragging my app then its working fine.
Also if I remove the above line of code then its working fine.
This is my Manifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.samsunmultiwindowstest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.samsunmultiwindowstest.MainActivity"
android:screenOrientation="portrait"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity>
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow"> </uses-library>
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />
</application>
how can I force portrait mode and get the multi window feature?
Thank you and sorry for my English.
Check out this Link Screen Orientation. It will help you understand different kinds of screen orientation. Also check this and this. will help you to enable multi window feature
I simply took out the size settings to solve my multiWindow issues.
IE: Remove these lines altogether.
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />

Categories

Resources