I am quite new to android and java, and I would like to have a bit of help from you to figure things out.
I have been working on a live wallpaper app lately, here is what I achieved and my blocking points:
I use the WallpaperService to create my custom LWP, I change its colors and shapes based on the user preference (preference fragment screen) with preferenceChangeListener.
My main activity just handles the preference fragments and UI. Is is my main menu where I can set the WP and change the preferences.
Here is my problem: I would like to show the live wallpaper preview as background of my main activity.
I haven't figured out a way to do this so far.
The only solution I found is to show the wallpaper through the activity by changing my Theme to a transparent one.
But this requires to set the wallpaper first. Once the WP is set, my app works exactly the way I want. But before that, my main activity can't show the WP preview because the service isn't running yet.
I don't think that there's a way to extract the WP preview from the WP service. I need to change something.
Also, I don't want to show only a sample img of the WP, I really want to run my code and show the results to the user as a preview.
Could you tell me how to change my code in order to get the correct behavior? I might have to use another class that I could run in parallel or something. It is a bit obscure to me...
Thank you very much!
Related
My question is about how to make splash screen, and finish the splash screen if the MainActivity done rendered, not by timeout set.
I have been searched how to make splash screen and i have done it, but mainly they are using timeout to set when the splash screen have to closed/finish.
What i want is how to finish the splash screen when the MainActivity completely rendered, not after how many seconds to close the splash screen.
Is there any way to get something like render completed state?
I tried to code the finishSplashScreen() in the onResume() and worked as i want, but the problem is, its always trigger the finishSplashScreen() when you reopenning the MainActivity whereas i just want to trigger that function only one time when the app is openned.
Is there any way to make what i want?
Update
I found what i need, this tricks simply useful.
http://saulmm.github.io/avoding-android-cold-starts
I have been searched how to make splash screen and i have done it, but mainly they are using timeout to set when the splash screen have to closed/finish.
Then you probably have not done it right.
Hard to tell without seeing your code obviously, however this link can most likely provide you guidance on how to build a proper SplashScreen :
https://medium.com/#ssaurel/create-a-splash-screen-on-android-the-right-way-93d6fb444857
No timeout, just a very fast-loading SplashScreen (no setContentView, only theming), and the only responsibility of this SplashScreen being to launch your MainActivity.
Hope that helps.
Is it possoble to rotate the whole android userinterface on an eventlistener ?
For example an app which runs in the background and after putting the headphones in the whole interface turn 180° until you put it out again.
Yes it is possible to change layout programmatically (Although not sure about 180 degrees?).
See this link: Change Screen Orientation programmatically using a Button
The first answer he has explained how to change layout programmatically instead of setOnClickListner you can use your eventListener.
EDIT: Look at this:
https://developer.android.com/reference/android/content/Intent.html#ACTION_HEADSET_PLUG
Its the broadcast which takes place in the event a headset was plugged in.
Guys i am developing Camera Application and this is my first android Application.
below i am Adding My App Screenshot for what i want.
First View :
Here , after Clicking on a Top-Right Corner Filter icon i want a below View.
Second View :
i don't know how can i get this type of a view. also how can i design this type of view into XML parts.
and i read more articles like how to Open a Multiple Surface-view Preview onto single screen but i did not get any much appreciate solution.
and Finally after selecting any of the Filter Preview i want a above Image type View.
means Selected Filter's is Preview apply onto Camera [Surfaceview Preview].
Please provide any type of Material link example.etc
guys please help me.any type of help will be appreciated..):
Thanks in advance
From the images, it's from a app called Geak Camera. Actually, I developed this app, and I used the GLSurfaceView not the surfaceview. And the app is not maintained now because I left that company. And I updated that app called "U camera".The scale animation was improved in "U camera".
All these manipulations can be performed with OpenCV. Download their basic Android example, and you can add your logic to onCameraFrame() callback.
I am sure this is a basic question, but I'm developing an Android app using ADK and Eclipse.
When I try to transition Activities, the screen goes black and then briefly shows the previous activity screen before "flipping" to the new screen.
I don't have any custom transitions; I'm using the default.
I don't have much going on in my onCreate event (EXCEPT: I load my background image during onCreate! Could it be this?)
I really am looking at a very snappy transition, like a game like Words with Friends, where it appears to switch "instantly".
This depends on what phone you're using since different phones use different anamations. Try to call finish(); on every activity but your main one for example.. Or finish them all when the user switches activities
I'm currently working on my first android project, which is to modify an existing sample program ("Tic Tac Toe" game). I'm going through the tutorials on the official website, but looking at the sample code I don't think I'll be able to figure everything out on my own in the time I have.
The modifications include being able to select a custom background, setting up a scoring system, and implementing a timed "blitz" mode. My basic questions are:
In which subfolder would the code that sets the background color/image for the game be?
Is there a way to create an Intent function that opens up a file search window to allow a user to select this custom background image?
I'd like to start here, I'm sure I'll have more questions as I go along. As always, any help is appreciated. (By the way, the code from the game is from the standard sample problems that come installed with the Android SDK for Eclipse).
Update 1:
So far I found this in a class called GameView:
mDrawableBg = getResources().getDrawable(R.drawable.lib_bg);
setBackgroundDrawable(mDrawableBg);
mDrawableBg is a Drawable object, I'm not sure what this part is refrencing:
R.drawable.lib_bg
What would be the proper way to modify the background in this piece of the code?
Update 2:
Here's where I'm at:
I have the getDrawable function taking another function as an argument:
mDrawableBg = getResources().getDrawable(getImage());
getImage() is suppose to return a integer referencing the selected image, here is the code (so far) for that function:
public int getImage(){
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, 10);
}
This is suppose to open the gallery and let the user select an image, I'm not sure how to return a reference ID to that selected image though. Also, the startActivityForResult function is not working properly, I don't think I'm using the Activity class properly.
The background is probably defined as either a drawable (in /res/drawable-*) or a color value (in /res/values/colors.xml or something like that). It will be referenced in one of the layout files in /res/layout. The layout file will be referenced by one of the activity classes in the Java source folders.
You can declare in code an array of drawable resource IDs and use that to dynamically generate a dialog and/or activity. The HorizontalScrollView widget might be useful for this. If you start a selection activity with an intent, use startActivityForResult instead of startActivity. You can then set the background of your top view using setBackgroundResource().