[Q]First application - Windows Phone 7 Q&A, Help & Troubleshooting

Hi guys, i want to do a very simple app for WP7.
It's my first app, so i'm very noob
I put a butto, and i want that when i click on it, it opens a picture.
How i can do that?
There is a guide for noob like me?

you might probably wanna check the guide from Microsoft student..

Please try this out an see if it works. This is using a default empty silverlight project.
In the designer (MainPage.xaml), add a button and an Image element using the XAML:
<Button Name="testButton" Width="140" Height="100" VerticalAlignment="Top" Click="testButton_Click">Open</Button>
<Image Name="imageElement" Width="300" Height="300"></Image>
This should be added inside the Grid Element named "ContentPanel"
Next add the image to your project by right clicking your project in the solution explorer and selecting:
Add -> Existing Item -> And add an image called "test-image.png"
Click on the added image, in the Properties box, set Build Action -> Copy Always
In the code-behind file (MainPage.xaml.cs), add the reference to the library BitmapImage by adding "using System.Windows.Media.Imaging;" to the top of the file.
Add a click event handler for the button using the code:
private void testButton_Click(object sender, RoutedEventArgs e)
{
Uri imageUri = new Uri("/[ProjectName];component/test-image.png", UriKind.Relative);
BitmapImage testImageBitmap = new BitmapImage(imageUri);
this.imageElement.Source = testImageBitmap;
}
But make sure to replace [ProjectName] with the name of your windows phone project.

Related

Android - setting style programmatically to dynamicly created compound components?

Im posting it here I cannot post in android developers forum.
I have following problem:
I have created compound component for irrelevant to the question purpose. I have also made a pretty nice style for it. While I apply the style in xml (using style="(at)style/xxx") it works flawlessly...
The problem starts when I need to dynamically create list of those compound components... simple call to:
new SubClassOfRelativeLayout(getContext(),null,R.style.xxx) does not give ANY effect.
So my question is as follows: do you, by any chance, know how to apply style (defined in xml resource file) to compound (custom) components that are subclass of RelativeLayout dynamically?
I started using
Code:
TypedArray array = getContext().obtainStyledAttributes(styleID, attributeIDArray);
and applying style manually - it is pain in *** but I have no idea how to do it other way ;/.
AzrealNimer said:
I started using
Code:
TypedArray array = getContext().obtainStyledAttributes(styleID, attributeIDArray);
and applying style manually - it is pain in *** but I have no idea how to do it other way ;/.
Click to expand...
Click to collapse
An old thread, but if you need to get that attributeIDArray, you can do it like this:
Code:
XmlPullParser parser = getResources().getLayout(R.layout.view_layout);
AttributeSet attributes = Xml.asAttributeSet(parser);

"long press of home button" configuration

Hi,
i searched a lot about this and didn't found an answer about this.
i'm using the LockerPro application as a lock screen but this means that the "long press of home button" can be still activated when i'm in the lockscreen.
in default Android phone the OS disable a lot of things when it is in lock screen mod for example the "long press of home button" that usually lead to
show the "history application" / "running application" list but this is disabled in lockscreen mode.
i'm assuming that if the OS is doing some API calls we can do the same or if the OS is registered in some policy we could do an application that will have the same policy that the lockscreen mod uses.
so, I wanted to know how the OS manage to do this and disable those so i could build an application on rooted phone that will do the same ?
I have started to dig more and found that the place that handle the "long home press" is :
"platform_frameworks_base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java" that is acctually located in the "android.policy.odex" file that is in the "system\framework\".
there is the following code:
private void handleLongPressOnHome() {
if (mLongPressOnHomeBehavior != LONG_PRESS_HOME_NOTHING) {
mHomeConsumed = true;
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) {
toggleRecentApps();
} else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_ASSIST) {
launchAssistAction();
}
}
}
Click to expand...
Click to collapse
so i can add a code that before that will update the "mLongPressOnHomeBehavior" from external place (i.e: file) and according to the value in the file we could change
the configuration of the "mLongPressOnHomeBehavior" and override the original behavior. if file doesn't exist then all goes as usual and if file exist read the overwritten value and act according to it...
any other suggestions on how to apply this with more ease ? is there any environment variables that we can set and get globally between the OS and the Applications ?
update:
for now just to see that it is working i have change the dalvik code to return void and don't preform anything and using this guid:
http://www.jordanhotmann.com/2011/08/how-to-change-default-orientation-of.html
I have generated a new android.policy.odex file to my system and it worked perfectly...
now i need to inject code that will read from a conf file what will be the operation of the "long pressed button" so an external application (with root) could dynamically
choose when to enable or disable the "long home press" functionality
will update soon and with Galaxy S4 + S3 latest versions new android.policy.odex for you all to enjoy ...
Regards,
LaBBa

[APP][For XDA devs][Sample Wallpaper chooser for rom devs]

HI ... !
I was looking for this stuff since ever and didn't find anything like it so I decided to share it here (sharing is caring ) because I know how painful it is to make apps from ground up and many rom devs have experience with smali but not with java and fear dealing with eclipse and android-studio
*NOTE : THIS PROJECT IS PROVIDED AS IS NO lICENSES AND IS OPEN SOURCE AND THERE ISNT ANYTHING PREVENTING YOU FROM USING THIS APP JUST MENTION ME WITH A SMALL SUPPORT BANNER WITH A REFERENCE TO THIS THREAD*
What is this project ?
This is a wallpaper chooser/picker in a gridview + nav drawer + material style so it looks damn cool in a red scheme .
Libraries used :
v7 appcompact --> material stuff
v4 support library --> grid elements etc ...
ikimuhendis:ldrawer by ikimuhendis ---> for nav drawer arrow
Source :
https://github.com/hashem78/APP_SAMPLEWALLPAPERCHOOSER
How to build :
You need a gradle based compile ide to build the app
IDE of choice -> android studio (intellij)
to build using android studio (assuming you have the source downloaded)--> 1. make sure you have android studio downloaded and setup properly having google support libraries downloaded and linked to your ide
2. File --> import --> choose the path of the app
3. Make your changes if you want (skip if not needed)
4. Build ---> make project
5. make a signutare and set your out location
done
Project structure :
build.gradle --> it has the local packages name of the app and libraries included also controls build tools version and sdk version and other things
app/src/main --> res folder (where the styles , strings , values and images are stored)
AndroidManifest.xml (class and activity definitions plus controling app wide theme)
app/src/main/java/mythi/samplewallpaperchooser/widget --> CustomDrawerLayout (the name tells it)
app/src/main/java/mythi/samplewallpaperchooser/ --> FullScreenImageActivity (activity class to display from resolution image when user clicks from grid view)
MainActivity --> (name tells it)
Sample --> (example class where you inflate the main activity view from)
SampleImageAdater --> (example class where you call your image resources)
so assuming you want to modify the app you have to
1. got to res/values/strings.xml change app_name refernce to what ever you want
2. add image resources to res/drawable-nodpi
3. change SampleImageAdapter definitions according to your needs
voila !
Credits :
Dave from stackoverflow
ikimuhendis for sliding drawer arrow
Google for support libraries
Xda
MerkMod team
todo :
design this thread
nothing ? anything ?
Sample app download . can be smalied and backsmalied
Bump ?
Good lookin sharing this brother

Anyone help me mod Silk Browser add long press back key

Sorry my english
I want mod Silk Browser TV full work for Shield TV. but Shield TV have not Menu key, and press Voice Search Shield will open Google Assistant(In Fire TV when i press Menu Key or Voice Search Key. It will open Menu of Silk).
I have ideal "long press Back Key to open Menu (call ) " use function
public boolean onKeyLongPress(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
// do some thing. i will put code showHome() in here
return true;
}
return super.onKeyLongPress(keyCode, event);
}
I create app "androidphysicalexample" use simple project bellow in eclispe and put code above in project.
https://examples.javacodegeeks.com/android/core/ui/events/android-physical-keys-example/
I use apk tool to decomplie apk androidphysicalexample to view function onKeyLongPress in file .smali then modify to .smali of Silk (i try modify to FireTvSlateActivity.smali but nothing when i long press back key )
Anyone can help me. thank
if you can help me. you can download Silk in here
https://drive.google.com/file/d/1XJCE6pt0BB--mb2n0W5K5IUg0ul8Z2Ww/view?usp=drivesdk
- and use website http://www.javadecompilers.com/apk
to decomplie to source code

Kotlin AlertBox with EditText

Hi,
I'm building an App and need to implement a possibility to enter text when the fab is clicked.
Code:
//Floating Action Button
val fab = my_fab
fab.setButtonIconResource(R.drawable.plus)
fab.setButtonPosition(POSITION_BOTTOM.or(POSITION_END))
fab.setOnClickListener{ fab ->
println("Clicked fab")
//updateDataset(data)
addToDataset("Jonas Eisele")
Instead of adding the static name I want to have a more dynamic way of entering names.
If you need some more code have a look at tradena.me [click on explore in the lower left corner] <-- this is a URL (I'm to new to post links)
thanks in advance
Jonas

Categories

Resources