[Q] launcher navigation - Java for Android App Development

Ok so i wanted to program a launcher. But the code to do this is soooo far beyond me its not funny. I understand programming well. and i made a fair bit back in the days of actionscript. However i need help understanding code for a basic launcher where you can display apps on a screen.
I want to eventually be able to make a launcher that has no pages. But is one big giant open world Like environment. Surprisingly ive tried to pay people to do this for me and still couldnt find anyone. Really getting the base code should be the hard part. Once i can understand the code well enough i dont think i will be able to manage that but it would cool if i understood it and was capable of it.
All help is appriecated.

No replies....

scorpafied said:
No replies....
Click to expand...
Click to collapse
To make an app respond to the home screen button press, you'll need to add an intent filter with your Activity tag in the manifest like so:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Launchers are like any other apps. Usually they query the system for activities that can be launched, like this:
final Intent allAppsIntent = new Intent(Intent.ACTION_MAIN, null);
allAppsIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List<ResolveInfo> packageList = getPackageManager().queryIntentActivities(allAppsIntent, 0);
You'll probably save your icons however they're laid out in a SQLite database, and then host widgets in various views (a good tutorial is here). You might also want to look at the Launcher2 source code, although it's pretty confusing. Good luck.

I tried the link u provided and it went to a page that said "there is no such post. ". im still learning java so i will definitely check out the source code but it may take a fair bit of time before i understand it.
also i know launchers are like any other app. But its the code behind how you will navigate around for the launcher im gonna have problems with.
Thanks for the advise though.

Related

Admob problem

Good evening.
I am currently developing an application and decided to try Admob ads.
Unfortunately after following Admob's guide (pretty simple one, good job on that) I get no ad, whether I run it on the emulator or on my phone (HTC Desire). The weird part is that the ad has shown a couple of times (i really mean just a couple of times), in hundreds of tries. And checking my account on Admob I see that there are 6000 requests from this app.
I started a new applcation, from blank, with no changes.
Any clues?
This is what I have done so far:
Added Adbmo's library jar.
Added these in my manifest (with a proper ID):
<meta-data android:value="axxxxxxxxxxxxxx" android:name="ADMOB_PUBLISHER_ID" />
<uses-permission android:name="android.permission.INTERNET" />
Created a attrs.xml file in res/values with this content:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.admob.android.ads.AdView">
<attr name="backgroundColor" format="color" />
<attr name="primaryTextColor" format="color" />
<attr name="secondaryTextColor" format="color" />
<attr name="keywords" format="string" />
<attr name="refreshInterval" format="integer" />
</declare-styleable>
</resources>
Added the following to my layoyt (RelativeLayout):
below RelativeLayout line, with the correct application name instead of xxxx:
xmlns:app="httx://schemas.android.com/apk/res/com.me.xxxx"
and:
<com.admob.android.ads.AdView
android:id="'at'+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:backgroundColor="#000000"
apprimaryTextColor="#FFFFFF"
app:secondaryTextColor="#CCCCCC"
/>
As the above did not work I tried the following, but also without success:
AdView example_adview = (AdView) findViewById(R.id.ad);
example_adview.setVisibility(AdView.VISIBLE);
example_adview.requestFreshAd();
I would appreciate if someone could help me.
An off-topic question, when running my application (only this one) in ecplise (Windows), I always the device chooser, even though only my phone is connected and the emulator is not running. It's nothing that disturbs my development, but it's a bit annoying having to choose every time I run the application.
Thank you very much,
Kryex
I think this is caused by low fill rate of admob. If Admob didn't supply any ads for you to display, you got a empty ads.
High fill rate > more ads that are availabe to display.
and each time a user can 'view' ur ads, the fill rate increase.
Yes you don't always see ads because of low fill rate, also in Admob under add categories grown up ads (gambling etc NOT porn) are off by default, I switched those on and got a better fill rate.
Ha this method is good. Let me try on! Thanks for share!
your app needs to be out for atleast a couple of days and have a few hundred downloads at least before ads show up ALMOST every time... (hint: if you enable "age appropriate" ads you'll usually get more ads showing up)

Signing apps help needed!

I got my app ready to go, 99% positive I did everything right so...
I used the jarsigner to sign my app as suggested by google and I get the jar verified message but when I try to upload it to the market it says its not properly signed?!
I googled n read n google n read and cannot find the problem or a solution, I've seen people saying its just a bug, restart, reinstall, try again. Or ppl saying its something wrong with the editing of the manifest and even a icon in the apk causing the error...
I've tried everything n I just can't seem to figure it out so I ask for someone familiar with this issue to please help cus my brain is fried!
I also wanna add that zipalign doesn't work for me either, I use a bat file that someone created on here that does it automatically cus when I try n use command prompt it keeps giving a cannot open .zip or can't find error?!
Again, I would really appreciate the help! I got my app, payed my fee n I'm ready to go, I just need help gettin past this. Thx!
Sent from my SPH-D700 using XDA App
Are you using eclipse to write the app? If so, just use Eclipse's "Export" (File->Export) function to do all the work for you.
I used the app inventor and used all the tutorials that are floatin around everywhere. I have eclipse but dont know how to use it cus its more code based and I havent reached that point yet. Even if there was a way to import the apk to Eclipse just do sign it would be great but I dont think it can be done. Its weird cus now I cant even get me apk to recompile after editing the xml file either! I've tried everything manually and fount programs that do it for you with one click and nothing... Its just one headache after another and I cannot figure it out nomatter how much googlin and searching on here I do! Im also starting to think it has something to do with the way the xml file is edited, I've read the tutorials and watched the videos and it seems to be right so if thats the case then I just done know... Im gonna post my xml file so anybody with this knowledge can take a look at it...
I also wanted to add that I am self taught in all this, besides getting help from others to learn so when editing a xml file I just copy, paste, backspace n enter which is what Im guessing Im suppose to do, I match up everything as others have it but Im not sure if iIm suppose to be using different commands or with xml editing things work different... So if thats the case please "school" me on that lol. Thanks!
This is what my .xml looks like...
This is how it comes up on Internet Explorer, when Im in notepad editing it doesnt show the - symbols though, maybe thats my mess up, I dont know cus it doesnt show them in notepad lol. HEADACHES! lol.
<?xml version="1.0" encoding="UTF-8" ?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
package="appinventor.ai_djykcor1.LOTF" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-sdk android:minSdkVersion="3" />
- <application android:label="LOTF" android:icon="@drawable/ya">
- <activity android:label="LOTF" android:name=".Screen1">
- <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.devtools.simple.runtime.components.android.ListPickerActivity" android:configChanges="keyboardHidden|orientation" />
- <activity android:name="com.google.devtools.simple.runtime.components.android.WebViewActivity" android:configChanges="keyboardHidden|orientation">
- <intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
I've never used app-inventor so I can't help you with this. I always just export from eclipse.
Well when I try to import it to Eclipse it gives a error and the xml file cant be read properly or somethin, It has a icon on it that seems to make it look as a error...
com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read C:\android-sdk-windows\AndroidManifest.xml: java.io.FileNotFoundException: C:\android-sdk-windows\AndroidManifest.xml (The system cannot find the file specified)
As a long time programmer, I'll use anything that helps me develop code quickly and easily. And, IMO, Eclipse is the tool.
Creating, testing and deploying your app in Eclipse is great. Signing an app via Export (as mentioned above) takes about 30 seconds.
Google for Android Eclipse Hello World app and it will walk you through doing an app in Eclipse.
Then you can create a new project and copy your code and xml into the project.
I have been learning in eclipse now and I finally got things to go except I keep getting force closes now with my app and Im lost from here... I anybody can help id really appreciate it!
Learn how to log messages, put them in your code to trace its logic and then use logcat to see where the program is abending (old COBOL term for force stopped LOL).
ykman1 said:
I got my app ready to go, 99% positive I did everything right so...
I used the jarsigner to sign my app as suggested by google and I get the jar verified message but when I try to upload it to the market it says its not properly signed?!
I googled n read n google n read and cannot find the problem or a solution, I've seen people saying its just a bug, restart, reinstall, try again. Or ppl saying its something wrong with the editing of the manifest and even a icon in the apk causing the error...
I've tried everything n I just can't seem to figure it out so I ask for someone familiar with this issue to please help cus my brain is fried!
I also wanna add that zipalign doesn't work for me either, I use a bat file that someone created on here that does it automatically cus when I try n use command prompt it keeps giving a cannot open .zip or can't find error?!
Again, I would really appreciate the help! I got my app, payed my fee n I'm ready to go, I just need help gettin past this. Thx!
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
There's Two Apps Available On The Market That Sign Apk's, Zip's, & Jar's
"Zipsigner", & "Signapktic"! I Personally Like "Signapktic", But Both Work!!!
Sent from my HERO200 using XDA App
Well now I got everything good to go but now Im getting force closes so it seems to be a debugging issue that Im tryin to figure out... If any of you can help I'd greatly appreciate it. Shoot me a PM with your # or email, I'm completely lost from here and its SSOOO frustrating cus Im right at the end of the process...
ykman1 said:
Well now I got everything good to go but now Im getting force closes so it seems to be a debugging issue that Im tryin to figure out... If any of you can help I'd greatly appreciate it. Shoot me a PM with your # or email, I'm completely lost from here and its SSOOO frustrating cus Im right at the end of the process...
Click to expand...
Click to collapse
What's the app exactly? I might be able to help.
Debugging can be one of the most frustrating or satisfying jobs as a programmer.
As I said earlier, put Log.v or Toast messages before and after every line of code if you have to. Check the logcat. Comment-out chunks of code until it runs. Un-comment one line at a time till it blows up and you should find your problem and be able to fix it.
Rootstonian said:
Debugging can be one of the most frustrating or satisfying jobs as a programmer.
As I said earlier, put Log.v or Toast messages before and after every line of code if you have to. Check the logcat. Comment-out chunks of code until it runs. Un-comment one line at a time till it blows up and you should find your problem and be able to fix it.
Click to expand...
Click to collapse
Programmers life in a nutshell lol.
Yeah buddy, been there, done that. In college, while taking COBOL, learning to debug an ABEND was a nightmare; no help whatsoever to where it was bombing unless you let it print the 500 green bar pages of the dump . Off topic but...
We had this one room for the advanced class...crappy old IBM terminals, but we had our OWN line printer...which meant we didn't have to go and wait at computer center for our output. This printer was on a table in front of the room and when it fired up, it was soooo loud and actually shook all the tables in the room.
We were all intent on our coding, but sometimes, in the back of our heads, we noticed the printer NOT stopping. Once one of us realized it wasn't a lot of back to back job prints, we knew someone had sent a dump to the printer! The pour soul was summoned to go up and cancel the job, head hung in shame ROFL!!
I appreciate the replies everyone, not sure if I said this before but I'm self taught in all this, learning one step at a time so now that it seems to be a debugging thing ima find the logcat n post it when I get to the lab. Thanks!
Sent from my SPH-D700 using XDA App
Newklearx3 said:
What's the app exactly? I might be able to help.
Click to expand...
Click to collapse
The process is I am making the app in app inventor then importing it to eclipse to edit and make any changes, I am not as advanced to work stricly with code so I use the AI as a base to start the project and I'm learning one step at a time when editing or generating code. Ima be taking a class on this soon once I figure out the best thing to go for... thanks
Sent from my SPH-D700 using XDA App

Stock Reader page turn refresh rate

Some people might want to change how often a page turn in the stock Reader app does a full refresh.
This is neither documented or given a user setting, but it can be changed.
Edit the file /data/data/com.bn.nook.reader.activities/shared_prefs/ReaderPreferences.xml
Code:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<float name="font_size" value="8.5" />
<string name="font_style">Caecilia</string>
<int name="periodical_margin_size" value="1" />
<int name="margin_size" value="1" />
<int name="bgcolor" value="1" />
<int name="line_spacing" value="150" />
<int name="page_forward_mapping" value="1" />
[b]<int name="fullscreen_refresh_count" value="6" />[/b]
</map>
The default without a setting is 6.
I'd love to make that one because of the odd ghosting issue with mine. Can I edit that while it's running?
Yes, you can edit that at any time.
It may not notice it immediately, certainly rebooting will work though.
This no longer works with Glowlight. There is no "fullscreen_refresh_count" tag anymore and if you add one, it just gets wiped out.
The file on NST with 1.1.2 firmware don't contains this strucutre of xml.
Edit refresh count is not possible from this file.
dxcore35 said:
The file on NST with 1.1.2 firmware don't contains this structure of xml.
Edit refresh count is not possible from this file.
Click to expand...
Click to collapse
No, the entry is not in the XML file by default.
Yes, you can put it in there and it gets read.
@GlowWorm owners, the exact same code is in 1.1.5
Hmm, this parameter works when it's in there, but the Nook wipes it any time you change any user reader preference.
Renate NST said:
No, the entry is not in the XML file by default.
Yes, you can put it in there and it gets read.
@GlowWorm owners, the exact same code is in 1.1.5
Hmm, this parameter works when it's in there, but the Nook wipes it any time you change any user reader preference.
Click to expand...
Click to collapse
I was not able to get it to register at all on my GlowLight. I still had a 6 page refresh. I did not update any settings. I also made sure the app was killed before I edited the XML file.
What can I say?
The Reader app has so much broken stuff in it.
I'm getting sick of patching things.
Renate NST said:
What can I say?
The Reader app has so much broken stuff in it.
I'm getting sick of patching things.
Click to expand...
Click to collapse
You can report a bug on B&N forums.
Admin might forward it to dev. team.
They don't even have any web pages for users to enter suggestions/bugs and track progress...
Looking at how they deal with other bugs, like lost bookmarks, I doubt anything will be fixed.
IMO, is B&N makes source available, community will help them.
But again, looks like they are not interested in bug fixing at all...
Could someone please give a quick explanation of how to get to the ReaderPreferences file and how to edit it?
The inability to do a page refresh, and the ghosting on the screen because of that, is what caused me to return my Simple Touch. If I could just get it to refresh every page turn I'd be happy. I do't want to root the device and turn it into a Android tablet, I just want a more frequent page refresh.
Renate NST said:
What can I say?
The Reader app has so much broken stuff in it.
I'm getting sick of patching things.
Click to expand...
Click to collapse
Renate. Somebody on the B&N forums is looking for this fix. I'd think a startup script could re-insert that line into the file on each boot. Is there an equivalent to an init script on a stock NST that could be tweaked?
Just realized you're in Boston. I'm flying out of Logan today!
bobstro said:
Is there an equivalent to an init script on a stock NST that could be tweaked?
Click to expand...
Click to collapse
There are init.rc & init.goldfish.rc in uRamdisk. The instructions on how to [un]pack are in "Nook Touch Android Development" forums.
bobstro said:
Renate. Somebody on the B&N forums is looking for this fix. I'd think a startup script could re-insert that line into the file on each boot. Is there an equivalent to an init script on a stock NST that could be tweaked?
Just realized you're in Boston. I'm flying out of Logan today!
Click to expand...
Click to collapse
You can always make the file read-only. (i.e. take away write permissions.) That kept the line from being eliminated.
Unfortunately, it does not help me and my 1.1.5 woes. The read-only file would not parse, and I was not able to get a refresh rate faster than 6 pages.
IBNobody said:
You can always make the file read-only. (i.e. take away write permissions.) That kept the line from being eliminated.
Unfortunately, it does not help me and my 1.1.5 woes. The read-only file would not parse, and I was not able to get a refresh rate faster than 6 pages.
Click to expand...
Click to collapse
I'm sure they program to open file in read-write more and it throws. :good:
Take a look on ddms messages.
I'm mostly almost finished with my smali patcher and I'll be getting around to stuff like this.
Using the patcher will allow people to get a subset of whichever patches they want.
For instance, I don't need the Last Read Page to be uplinked to the (B&N) cloud.
Some people might want that. Tastes differ.
Renate NST said:
I'm mostly almost finished with my smali patcher and I'll be getting around to stuff like this.
Using the patcher will allow people to get a subset of whichever patches they want.
For instance, I don't need the Last Read Page to be uplinked to the (B&N) cloud.
Some people might want that. Tastes differ.
Click to expand...
Click to collapse
Renate,
Could you open new “Patching Reader”, “Patching stuff” or something thread, so it won’t get buried into another one.
Will be interesting to see whole approach.
How to patch, un-patch (to apply new B&N update)
And how to deal with installation errors (certificate errors, etc.)
You know this stuff better than anyone else, anyway.
I know it's been a month since anyone said anything in this thread, but is there an easy way to do this? I just got a refurb NST and the leftover image when it doesn't do a full page refresh is annoying, it messes up text and in bright light I can still read the characters in the empty space that wasn't empty in the page before. It doesn't make reading hard or impossible, just annoying.
I really need something easy or at least well explained. It took me hours and searching to get adb to work with my NST last night and even rooting wasn't all that easy as the first program for flashing the boot img to the sd card didn't work for me, and then I completely failed at getting gapps to work with it because of poor instructions. I've rooted and rommed plenty of phones, so I'm comfortable with android. There just doesn't seem to be enough popularity for this device to get easy hacks, and I don't know how to do technical stuff like editing an xml.
Thinking about it, if there isn't an easy fix, can I just sideload a root browser app and manually navigate to and edit that xml file?
EDIT: Tried manually editing the xml file, the reader app just rewrites it every time I try to read something, and deletes root browser's .bak backup file. Quite annoying.
I looked into this stuff a bit.
It's spread all over the place.
B&N has a section that deletes a bunch of preferences before writing.
Personally, I've never noticed shadowing.
The contrast seems to get to be a little bit less each time though.
The dictionary stuff was a higher priority last month.
Realize that on any Nook mod only a handful of people will ever use it.
Renate NST said:
I looked into this stuff a bit.
It's spread all over the place.
B&N has a section that deletes a bunch of preferences before writing.
Personally, I've never noticed shadowing.
The contrast seems to get to be a little bit less each time though.
The dictionary stuff was a higher priority last month.
Realize that on any Nook mod only a handful of people will ever use it.
Click to expand...
Click to collapse
True, I'm sure that most people are just using a different app. After realizing from this thread that just editing the xml won't work and making it read only just makes things worse, I decided to try cool reader 3. It isn't as elegant as the nook software by any means, but at least it does a page refresh every page. It does make me wonder if it would be hard to make a universal ereader app that works well on all android based e-ink devices though.
Either way if someone is working on any sort of patch, I still think that would be great. Today was my first full day with the nook and reading definitely got annoying from time to time when I was a couple pages from the full refresh and the letters looked dull in spots and stuff. Since mine is a refurb it is possible it is a bit worse than others on refreshing the screen, and maybe was returned for that. It's not unusable, just annoying to a perfectionist like me.
I went back to look at this again.
I modified /data/data/com.bn.nook.reader.activities/shared_prefs/ReaderPreferences.xml
I added in:
Code:
<int name="fullscreen_refresh_count" value="1" />
I did everything that I could think of and it never disappeared.
I switched books, changed fonts, changed page buttons, it's still there.
(And it was refreshing every page.)
Could somebody tell me under what circumstance it disappears?

Creating Service in 4.0.3

Hi.
A while ago (2 years ago) I created a service-only app and targeting 2.2
But now when I use the same method to create a similar service targeting up to 4.0.3 it does not start.
I searched and I have read very blurry answers that after 3.1 the service must have an activity to even launch.
Previously it always started with an BOOT_COMPLETE intent. And my dummy code is succesfully starting this way on 2.1 and 2.2 in AVD.
But in 4.0.3 the intent is never fired.
Doeas somebody have any concrete answer to this?
OR even better (if it exists) a small explaination on howto make an service that not have an icon and starts at boot, that works on 4+.
Much appriciated. :fingers-crossed:
Nobody?
KaktusHater said:
Nobody?
Click to expand...
Click to collapse
Give it time sir I faced this problem a while back. If I recall the service has to be run first, in essence pre-approved before It will handle boot_complete broadcast. From what I gather this is a security feature introduced in ICS to stop "silent" rogue apps running at boot time. Also it need to be installed in internal storage because boot_completed is fired before external storage is mounted as explained in this document on the android developer site
This Stackoverflow post might shed some light on your query , I think It also gives sound reasoning towards why you should have an Icon.
If you're really intent ( no pun intended :laugh: ) on not having an Icon, there's a couple of things to try,
You may be able to get around including an activity by signing your apk with the platform keys, obviously this is only an option if you have the platform key which is normally only the case if you've built a custom rom from source
If that is not an option removing <category android:name="android.intent.category.LAUNCHER" /> will remove you app from the launcher but that would mean you would have to find a way of firing the activity on installation.
I've not tested either of them, but they both sound quite plausable ( to me at least ) . I'll leave this voyage of discovery to you
Good Luck!

Make an app to a Camera app

Hello,
this may be a weird question for this forum (if moderators think it is wrongly placed, please push it to the correct section).
I'm a developer but have never developed anything for android. I wonder if what I want to achieve is possible or not.
My problem:
I want to use VSCO cam as my default camera (e.g. on my lockscreen I can specify a default camera to be launched by clicking on an icon)
VSCO cam has for some reason decided not to "register" as a camera app if that makes sense (in the selection screen of camera apps it doesn't show up)
So my questions are:
What does an app need to do to be recognised as a camera app by other apps? Is it as simple as an entry in a config file? Or is it a java routine? Please name all modifications that would have to occur.
I downloaded the VSCO apk and unzipped it - I should be able to modify it and then still install without problems right?
Just to state the obvious - I don't want to offer this modified app to anybody besides myself. I don't want to add it to google play or even offer it as a download somewhere. This would be just a personal project of mine.
Need Android intent filter
001mic said:
So my questions are:
What does an app need to do to be recognised as a camera app by other apps? Is it as simple as an entry in a config file? Or is it a java routine? Please name all modifications that would have to occur.
I downloaded the VSCO apk and unzipped it - I should be able to modify it and then still install without problems right?
Just to state the obvious - I don't want to offer this modified app to anybody besides myself. I don't want to add it to google play or even offer it as a download somewhere. This would be just a personal project of mine.
Click to expand...
Click to collapse
To be recognized as a camera app and be able to respond the incoming request, the Android intent filter has to be specified.
Foxbrush said:
To be recognized as a camera app and be able to respond the incoming request, the Android intent filter has to be specified.
Click to expand...
Click to collapse
Can you be a little bit more specific? Is it just a change of the Android Manifest xml file?
The file looks weirdly compressed. Can you have a look at it and tell me if you think it's possible to do the required changes...
https://dl.dropboxusercontent.com/u/6568643/AndroidManifest.xml
Cool it worked! Thanks a lot!
I had to add this intend as well to the other in order for my lockscreen app to detect it:
<intent-filter>
<action android:name="android.media.action.STILL_IMAGE_CAMERA"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

Categories

Resources