Android Paste onClick - java

pretty simple question here but I cant seem to find anything. Anyway, There is a game on android and with a keyboard you can enter a cheat id like to use(personal use not uploading to market) . Well I created a static button that remains on-top of all activities. Id like to just click my button and have it paste the word to the game so the cheat will be entered. Anyway to paste onclick? I cant see this being hard

You can't make other apps behave in a different way than they do as it violates the whole sandboxing idea of android (unless of course the app itself allows it in some way or another) .
What you can do is to copy the content to the clipboard , and allow the user to paste it anywhere he can .
More info about it here:
http://developer.android.com/guide/topics/text/copy-paste.html
There might be root solution , but like many root operations , i really lacks this knowledge of how to do it.

Related

LibGdx Android Keyboard Autocomplete

I'm currently building a small game for Android using LibGdx in Android Studio. In the game the player uses the on-screen keyboard to enter different letters one by one.
My problem is that the autocomplete is one (since I use it when I'm texting) and this forces the player to click the "suggestion box" after every typed letter to actually make sure that the keyboard press and character input is registered. Since the input in my game should be one letter at a time I don't want autocomplete to try to "guess"/create a word.
I'm using the InputProcessor class with the "keyTyped(char character)" function. If I turn of the auto complete in phone settings (manually before starting the game) the input is registered and the correct character is passed in.
So, my question is if there is any way to turn off/toggle autocomplete programmatically?
Thanks in advance!
I realise this is old but if you or anyone else is looking for a way to do this then I have a solution. I built a completely new method for Android soft keyboard input to tackle the issues involved with the current libgdx methods. I am surprised to read auto-complete was actually working for you, because on all my testing devices it does not, and this is one of the problems I have attempted to solve.
I have built a sample project for people to work with that allows for much more reliable input using the Android soft keyboard, this includes swype, auto-correct, dictionary, etc. What you may be interested in is I have also included some customisation for the keyboard, such as the ability to disable auto-complete and suggestions. You would simply customise your TextFieldStyle with;
textFieldStyle.androidKeyboardAutoCorrect = false;
textFieldStyle.androidKeyboardTextSuggestions = false;
As of posting, no one has used this sample project and I have only tested on a few devices, so it may be a little erroneous. I will carry on maintaining it when/if feedback is received.
You can find it on Github here (source and executable apk)
If you have any comments/feedback please refer to Github or the badlogic forum topic
Hope this helps!

How to print the Matrix(nrow x mcolumns) to ANDROID Screen?

I am having a java program which performs MATRIX ADDITION.I want to implement this to ANDROID.I have done layout also for this purpose.But how to implement this to android in such a way to get input from user and to print the output to mobile screen.I know that i cant use "System.out.print()" function here
It seems that you have very basic holes in knowledge in regards to android development, so as others have advised, you should check out http://developer.android.com/training/index.html. I will attempt to give you some start though, if you know general java programming, you can create an EditText view and then populate it as you would usually, but instead of using System.out.println(""); (if your EditText view is named editText1), use editText1.setText("");

Adding ColorPickerPreference Library when it's not a preference

I'm trying to add a ColorPicker to my app. I see a lot a of ColorPickers (the one frome the API'S Samples, the one from Cyanogen, the AmbilWarna library, the HoloColorPicker, and the ColorPickerPreference). I think that the best for my app is the last one, but I don't need to use it on a preference.
So, what I want is to use this library inside my project when I click a button, and then take the resulting code from the SharedPreferences(I think, I don't know it), and use that color as I want for my app.
I try to use only some of the classes (only ColorPickerDialog, ColorPickerView, ColorPickerPanelView and AlphaPatternDrawable) and then I think that I have to do:
ColorPickerDialog dialog = new ColorPickerDialog(Main.this, Color.BLACK);
dialog.show();
And now I don't know how can I have the selected color.
Also I added to my project the xml view.
Any idea?
To know what is the selected color you need to to:
color=dialog.getfinalColor();
So, I think that the problem was easy to solve it. But now the problem is find a listener to detect when the dialog is closed and then to save the variable "color".

Custom Button from 9patches WITHOUT XML

I would like to create a custom Android button from 9patches, but without using any XML. I know, it sounds dumb, but the reason is that for some reason my IDE (NetBeans) messes up the whole XML beyond belief. The R.java doesn't get generated half the time (the fixes didn't work for me), and I get random errors, even if I just copy and paste XML from tutorials.
This is how I plan to create the Button:
The button has a setBackgroundDrawable() method
I need to suply this method with a StateListDrawable
Which I need to build up from NinePatchDrawables
So first I need to create the 9patches, then a StateListDrawable from them, and simply pass the StateListDrawable as background for my Button's setBackgroundDrawable() method.
I can't start the 9patches, because I can't find out how the constructors work.
Wouldn't it make more sense for you to invest your time in either:
fixing NetBeans, or
switching to some different editor/IDE?
Trying to do Android development without XML is akin to trying to fly without wings. It's possible, but rockets tend to crash and burn in the end.
Regardless, you do not need to directly work with NinePatchDrawable to use nine-patch PNG files. Android will handle that part for you.
Instead, create an instance of StateListDrawable and call addState() for each one of your states. To get the Drawable for the state, use getResources().getDrawable(R.drawable.this_is_one_of_your_nine_patch_images) from your Activity. Android will detect that this is a nine-patch and will do the right thing.

how do i create a cocos2d particle effect in cocos2d android 1?

I'm using the android version of cocos2d located here:
https://github.com/ZhouWeikuan/cocos2d
I'm an iPhone guy checking out android who already has familiarity with cocos2d iPhone. Ideally i would be able to create the particle from a plist file in the package/bundle. I can't seem to even get the "premade" default style particles working ie CCParticleFireworks (I've only tried in the simulator though). I was disappointed that there is very little sample code out there for cocos2d android so if anyone has a good resource on this I would be interested as well. I'm just learning java as well so it may be something simple just looking for some code snippet I can use basically.
The behavior im seeing with all my attempts is just a crash as soon as i try to instantiate and add the particle to the scene. I'm not too great at debugging in eclise either so i can't say exactly when the app is dying. sorry. I'm trying to suck less. I'd put my code in but ive tried it a bunch of different ways and I don't want to look like an ass. but here goes anyway, so here's how i think it should work:
public boolean ccTouchesBegan(MotionEvent event)
{
CGPoint location = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(event.getX(), event.getY()));
CCParticleSystem part = CCParticleSystem.particleWithFile("0.plist");
part.setPosition(location.x, location.y);
addChild(part);
return true;
}
0.plist is in my assets folder, i feel like i need to turn this into a hash or something. also i feel there might be a problem with the ccparticlesystem vs ccpointparticlesystem vs ccquadParticleSystem.
You should try WiEngine . It is the Best Cocos2d java android port. Cocos2d-android don't even have 3d implemented. The classes are there but empty. Also check Wiengine's api Demo from the android market
Last time I checked with the author he mentioned that scene transition, grid actions, and particle systems on cocos2d-android-1's 3D are flawed.
I would recommend trying cocos2d-x if you have cocos2d-iphone code to port or coding your own thing extending View.

Categories