Android rename: unable to find explicit activity class - java

I have a live wallpaper based off of some open source code that I heavily modified. As the last item, I right clicked on it in Eclipse to change the package name and all was well with the world. The wallpaper works right. The settings menu works right. But when I try to click an item in the settings menu to launch another activity, I get:
10-10 16:16:56.215: E/AndroidRuntime(13825): FATAL EXCEPTION: main
10-10 16:16:56.215: E/AndroidRuntime(13825): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.nightscapecreations.orionkeysfree/ffvideolivewallpaper.frankandrobot.com.extLinkNC}; have you declared this activity in your AndroidManifest.xml?
Here is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nightscapecreations.anim1"
android:versionCode="1"
android:versionName="0.9.0" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" />
<!-- Tell the system this app requires OpenGL ES 2.0. -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature android:name="android.software.live_wallpaper" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<service
android:name="ffvideolivewallpaper.frankandrobot.com.VideoLiveWallpaper"
android:label="#string/wallpaper"
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="ffvideolivewallpaper.frankandrobot.com.VideoLiveWallpaper"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.VideoWallpaperSettings"
android:exported="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.About"
android:exported="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.License"
android:exported="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.SelectVideo"
android:exported="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
android:exported="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.extLinkZazzle"
android:exported="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.extLinkFacebook"
android:exported="true"
android:label="#string/app_name" >
</activity>
<activity
android:name="ffvideolivewallpaper.frankandrobot.com.extLinkGooglePlus"
android:exported="true"
android:label="#string/app_name" >
</activity>
</application>
</manifest>
Here is the About activity, as an example, which was confirmed working before this change:
package ffvideolivewallpaper.frankandrobot.com;
import android.app.Activity;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import android.content.Intent;
import android.view.View;
import com.nightscapecreations.anim1.R;
public class About extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
TextView t = (TextView) findViewById(R.id.about_box);
t.setMovementMethod(LinkMovementMethod.getInstance());
}
public void showLicense(View view) {
startActivity(new Intent(About.this, License.class));
}
}
ffvideolivewallpaper.frankandrobot.com was the old package name. Eclipse added the prefix to the android:name for all activities during the package name change. What I don't understand is that if this is incorrect then why does the wallpaper work at all since the service name is qualified the exact same way?
EDIT
Dunamis made an excellent catch. The original name was
ffvideolivewallpaper.frankandrobot.com, but it's been through several name changes since then. One such name was com.nightscapecreations.orionkeysfree. It looks like there was still a reference to that old name which I totally missed in the settings xml file. Example:
<PreferenceCategory android:title="Links and Information" >
<PreferenceScreen android:title="Visit Nightscape Creations"
android:summary="See more live wallpapers, get free static wallpapers, and learn about NC by visiting us online." >
<intent
android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
android:targetPackage="com.nightscapecreations.orionkeysfree" />
</PreferenceScreen>
However, this still does not work. I tried every combination of fully qualified name and simple dot notation ".extLinkFacebook" between this file and the manifest file, but without success. Here is the error I'm receiving now with both names fully qualified:
10-11 08:19:43.176: E/AndroidRuntime(25204): FATAL EXCEPTION: main
10-11 08:19:43.176: E/AndroidRuntime(25204): android.content.ActivityNotFoundException: Unable to find explicit activity class {ffvideolivewallpaper.frankandrobot.com/ffvideolivewallpaper.frankandrobot.com.extLinkFacebook}; have you declared this activity in your AndroidManifest.xml?
Here is the settings file for reference:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="Wallpaper Settings">
<ffvideolivewallpaper.frankandrobot.com.PrefsSlider
android:key="fps"
android:title="Framerate"
android:summary="Set the target framerate. Lower framerates will decrease resource usage. Requires wallpaper restart to take effect."
android:layout_width="fill_parent"
android:defaultValue="30"
android:orientation="vertical" />
<!-- <ListPreference -->
<!-- android:enabled="true" -->
<!-- android:key="resolution" -->
<!-- android:title="Resolution" -->
<!-- android:summary="Ultra resolution may decrease framerate. Only recommended for high end devices." -->
<!-- android:entries="#array/prefs_resolutionEntries" -->
<!-- android:entryValues="#array/prefs_resolutionValues" -->
<!-- android:defaultValue="512" /> -->
<!-- <ListPreference -->
<!-- android:enabled="true" -->
<!-- android:key="frameTonality" -->
<!-- android:title="Filters" -->
<!-- android:summary="Various effects and filters can be applied to the animation" -->
<!-- android:entries="#array/prefs_tonalityEntries" -->
<!-- android:entryValues="#array/prefs_tonalityValues" -->
<!-- android:defaultValue="1" /> -->
</PreferenceCategory>
<PreferenceCategory android:title="Links and Information" >
<PreferenceScreen android:title="Visit Nightscape Creations"
android:summary="See more live wallpapers, get free static wallpapers, and learn about NC by visiting us online." >
<intent
android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
</PreferenceScreen>
<PreferenceScreen
android:title="#string/prefsProductsHeading"
android:summary="#string/prefsProductsSummary" >
<intent
android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkZazzle"
android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
</PreferenceScreen>
<PreferenceScreen android:title="Like on Facebook" >
<intent
android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkFacebook"
android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
</PreferenceScreen>
<PreferenceScreen android:title="Like on Google+" >
<intent
android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkGooglePlus"
android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="About" >
<PreferenceScreen android:title="About" >
<intent
android:targetClass="ffvideolivewallpaper.frankandrobot.com.About"
android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>

Shortly after adding the bounty I found a workaround for this problem. I'm still not sure what the original issue was, though.
To resolve this I renamed the ffvideolivewallpaper.frankandrobot.com package, which contained all the code, to match that of the manifest. I had hesitated to do this as it required an update to the video.c file to change all "ffvideolivewallpaper_frankandrobot_com" references in native calls to "com_nightscapecreations_anim1" and the last time I had tried that I hosed the app so bad I had to return to a backup copy. However, after doing so today, and then search/replacing through the app to find all other references, I was able to get it to work.
I would still like to know the answer to the above question as it stands, though. It would be much easier to create new apps off this base in the future if I could just leave the main package name alone instead of bothering with a search/replace. If no one knows, though, I will just mark this as the answer.

Related

Issues running any new android project - Default Activity Not found / Invalid Java package

total noob with lots of issues with Android Studio.
Default Activity error
Invalid java package name
Getting a Default Activity error on any app or new project I run - below is an example of the AndroidManifest.xml
"Error running 'app': Default Activity not found"
I have checked more than 100 times I am using the right package names and that my activity is declared in the android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.coleary.change;">
<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="com.example.coleary.change.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="#string/TicTacToe"
android:theme="#style/AppTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The package name is the same in the java code:
package com.example.coleary.change;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
// use tictactoe code in our code for a new game
private TicTacToeGame mGame;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(com.example.coleary.change.R.layout.activity_main);
//this activity(game) is a context within a main activity
mGame= new TicTacToeGame(this);
}
}
When I run the project I get the following error also:
Package 'com.example.coleary.change;' from AndroidManifest.xml is not a valid Java package name as 'change;' is not a valid Java identifier.
I have changed the package name through Refactoring to 5 different names to no avail.
I have spent over 15 hours hours trying to troubleshoot these issues and because I have the same issue on multiple projects / packages and apps I am completely stuck - any help really appreciated!
Remove the semi-colon after change in your AndroidManifest. Package names can't contain semi-colons.

Google Map in Android 2.3.4 shows gray box on both AVD and real device

I'm trying to show a simple google map on my real Samsung device where Android version is 2.3.4.
got my SHA1 key
got my API key from google
Here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.neighbourhoodlocator"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBq8ATEI-DmBtso1T13S_DGfiT7cBgEav8" />
<activity
android:name="com.neighbourhoodlocator.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>
</application>
</manifest>
Here is my main.xml file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
Here is my Mainactivity.java file:
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Now the issue I'm having when I launch it on the real device, it doesn't crash, nor it throws any exception (No "Invalid Authorization" either); only thing I can see on the screen is a blank (gray box) with "+" and "-" button. I've tried Activity instead of FragmentActivity, application crashed.
I checked the logcat trace:
10-12 23:14:34.989: W/dalvikvm(15055): VFY: unable to resolve instance field 28
10-12 23:14:35.119: W/dalvikvm(15055): Unable to resolve superclass of Lmaps/p/w; (743)
10-12 23:14:35.119: W/dalvikvm(15055): Link of class 'Lmaps/p/w;' failed
10-12 23:14:35.119: W/dalvikvm(15055): Unable to resolve superclass of Lmaps/ap/as; (6267)
10-12 23:14:35.119: W/dalvikvm(15055): Link of class 'Lmaps/ap/as;' failed
10-12 23:14:35.139: W/dalvikvm(15055): Unable to resolve superclass of Lmaps/af/k; (5294)
10-12 23:14:35.139: W/dalvikvm(15055): Link of class 'Lmaps/af/k;' failed
10-12 23:14:35.139: E/dalvikvm(15055): Could not find class 'maps.af.k', referenced from method maps.ag.an.a
10-12 23:14:35.139: W/dalvikvm(15055): VFY: unable to resolve new-instance 5139 (Lmaps/af/k;) in Lmaps/ag/an;
I added the google-play-services_lib appropriately. and also added the android-support-v4.jar is also in "Android private libraries".
Notice that the project build target is: Google APIs 4.2.2
and the android version in my Samsung phone is: 2.3.4
I've been trying last couple of days, I also tried in the emulator, same thing is happening.
Please help me to solve the issue.
Thanks.
I had a similar problem.. I have solved it. Android emulators aren't working. You should work your app on your phone. When exporting your project, your sha1 is changing. You must copy that sha1 and make a new API-KEY in google api console. (don't forget the change manifest file). After uploading your phone, it works..

Blank Screen Android 2.2 Google Maps v2

EDIT :
I transferred my 20+ projects that tries to use Google Maps for Android v2. After changing keys and stuff, now, it works. I don't know what made this work, but thank you all. I got one keystore, the key is right. I guess it magically fixed somehow. Well, thanks guys.
I'm doing searches for 2 days and I couldn't fix this problem. I did everything, yet, this application can not work.
I want my application to work on Android 2.2 and above. Like it says "if you create your app in level 8, it'll support 95% of market".
Here are my screenshots and source codes:
I'm pasting the source code which is the easiest to get. I took this from web.
Here's the output of the command
keytool -list -keystore <path>
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: JKS Keystore provider: SUN
Your keystore contains 1 entry
androiddebugkey, 15.Mar.2013, PrivateKeyEntry,
Certificate fingerprint (SHA1): xxx
main.xml file:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="AIzaSyDim-x5Gxxx"
/>
manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhive.googlemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<!-- Add Google Map Library -->
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".AndroidGoogleMapsActivity"
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>
<!-- Allow to connect with internet -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
java file (no need to paste it all, but I guess it's best to paste it all)
http://pastebin.com/yF95Rcbd
Here are my screenshots:
http://i.imgur.com/gExHpUG.png
http://i.imgur.com/AMOXKhr.png
http://i.imgur.com/Aqon97Y.png
I'm trying to compile this app to Android 4.2.2, but I tried and want to make it work in 2.2 and above.
Here's the Android tab of the properties window just to make sure:
http://i.imgur.com/ht0CQwT.png
Here's my log
03-20 07:01:20.145: W/System.err(956): at java.lang.Thread.run(Thread.java:856)
03-20 07:01:20.665: W/System.err(956): IOException processing: 26
03-20 07:01:20.665: W/System.err(956): java.io.IOException: Server returned: 3
03-20 07:01:20.665: W/System.err(956): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
03-20 07:01:20.675: W/System.err(956): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
03-20 07:01:20.675: W/System.err(956): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
03-20 07:01:20.675: W/System.err(956): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
03-20 07:01:20.675: W/System.err(956): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
These lines repeat all the time.
Thank you very much.
Your post appears to contain code that is not properly formatted as code" error made
me delete the blank lines. Sorry for the messed up codes.
http://i.imgur.com/ht0CQwT.png
See the snapshot. You did not add Google Play Services library that is require for displaying Google Android Map V2. Please download and add that library and then try again.
Please also see the target. Your target is 4.2.2 and your are accessing it on 2.2. Change the target to 2.2 and use support fragment.
Thanks,
I have solved this issue,
Open your Google APIs Console
Choose API Access
Edit allowed Android apps from your API Key
Change the package name with your package name
Example: 00:06:A5:0E:04:A2:1E:8F:FE:6B:7F:46:23:C3:xx:xx:xx:xx:xx:xx;com.example.androidmapview
You are missing permissions and meta-data for API KEY.
Read this carefully: https://developers.google.com/maps/documentation/android/start
Working with android mapapi v2 ,the main reason is you must add play service to your app,like below :
<permission
android:name="com.example.androidmapview.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.androidmapview.permission.MAPS_RECEIVE" />
Use fragment class in Layout:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
And change your manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidmapview"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<permission
android:name="com.example.androidmapview.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.androidmapview.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.androidmapview.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></meta-data>
</application>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
</manifest>
in activity:
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SupportMapFragment fragment = new SupportMapFragment();
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, fragment).commit();
}
}
For more info check the link which will explain you in details about api v2
I solved my blank screen problem with zoom in/out buttons like that.(it happens after I changed my package name)
Delete the keystore file
Create a new keystore file
Get SHA1 fingerprint
Go to API Console
Create a new Android App.
Paste your fingerprint
Use the given API Key in your Manifest File
That worked for me

Adobe AIR packaging for Android

I seem to be getting this error... I believe I am typing everything correctly:
desktop/adobeairsdk/bin/adt -package -target apk -storetype pkcs12 -keystore ./desktop/mycert.p12 myApp.apk ./desktop/Untitled-1-app.xml -C ./desktop/Untitled-1.swf
To which I get:
unexpected failure: inputs not set
java.lang.IllegalStateException: inputs not set
at com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java:59)
at com.adobe.air.ADT.parseArgsAndGo(ADT.java:504)
at com.adobe.air.ADT.run(ADT.java:361)
at com.adobe.air.ADT.main(ADT.java:411)
Here is the content of my .xml file:
<?xml version ="1.0" encoding="utf-8" ?>
<application xmlns="http://ns.adobe.com/air/application/2.5">
<id>com.adobe.example.Untitled-1</id>
<versionNumber>1.000</versionNumber>
<filename>Untitled-1</filename>
<description></description>
<name>Untitled-1</name>
<copyright></copyright>
<initialWindow>
<content>Untitled-1.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
</initialWindow>
<supportedProfiles>mobileDevice</supportedProfiles>
<android>
<manifestAdditions>
<![CDATA[
<manifest android:installLocation='auto'>
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:normalScreens="true"/>
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
<application android:enabled="true">
<activity android:excludeFromRecents="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
]]>
</manifestAdditions>
</android>
<customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation>
<icon>
<image16x16>AppIconsForAIRPublish/AirApp_16.png</image16x16><image32x32>AppIconsForAIRPublish/AirApp_32.png</image32x32><image48x48>AppIconsForAIRPublish/AirApp_48.png</image48x48><image128x128>AppIconsForAIRPublish/AirApp_128.png</image128x128></icon>
</application>
I am a bit stuck... any ideas? O_o
Thank you for your help in advance.
Look at this post. Probably you didn't build the project before packaging it. You'll only want to create the AIR package to redistribute your application.
I also have this problem. Then I reboot win7. It works well after that.

How do I get a Java to call data from the Internet? Where to even start?

Hello oh great wizards of all things android. I really need your help. Mostly because my little brain just doesn't know were to start. I am trying to pull data from the internet to make a widget for the home screen. I have the layout built:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/Layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/widget_bg_normal"
android:clipChildren="false"
>
<TextView
android:id="#+id/text_view"
android:layout_width="100px"
android:layout_height="wrap_content"
android:paddingTop="18px"
android:layout_centerHorizontal="true"
android:textSize="8px"
android:text="158x154 Image downloaded from the internet goes here. Needs to be updated every evening at midnight or unless the button below is pressed. Now if I could only figure out exactly how to do this, life would be good."
/>
<Button
android:id="#+id/new_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Get New"
android:layout_below="#+id/scroll_image"
android:layout_centerHorizontal="true"
android:padding="0px"
android:textSize="10px"
android:height="8px"
android:includeFontPadding="false"
/>
</RelativeLayout>
Got the provider xml bulit:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="150dip"
android:minHeight="150dip"
android:updatePeriodMillis="10000"
android:initialLayout="#layout/widget"
/>
The Manifest works great.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dge.myandroid"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".myactivty"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Widget -->
<receiver
android:name=".mywidget"
android:label="#string/app_name"
>
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_UPDATE"
/>
</intent-filter>
<meta-data
android:name="android.appwidget.widgetprovider"
android:resource="#xml/widgetprovider"
/>
</receiver>
<!-- Widget End -->
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="7" />
</manifest>
The data it is calling looks something like this when it is called. It basically goes to a website that uses php to random the image:
<html><body bgcolor="#000000">center>
<a href="http://www.website.com" target="_blank">
<img border="0" src="http://www.webiste.com//0.gif"></a>
<img src="http://www.webiste.com" style="border:none;" />
</center></body></html>
But here is were I am stuck. I just don't know where to start at all. The java is so far beyond my little head that I don't know what to do.
package com.dge.myandroid;
import android.appwidget.AppWidgetProvider;
public class mywidget extends AppWidgetProvider {
}
The wiki example just confused me more. I just don't know where to begin. Please help.
If data is hosted on a WebSite, you can use HttpClient on Android to make the proper request and get your data.
These SO questions might help.
There is code at anddev doing pretty much what you want. The first post is about xml but if you read through there's more, including fetching and parsing HTML.

Categories