setOnClickListner - eclipse-indigo

I am totally new to Android development , recently i bought Lynda.com Android App Development video learning course.
I am facing following problem:
Created new project
Created new xml file with text field only
Then go to Main.xml(that was created by defualt) and replace the default text field with button.
Then go to Main.Java and try calling added button by code "Button b = (Button) findViewById(android.R.id.button1);"
After that I tried to call the setOnClickListner function by " b. " but there is no option with
name of setOnClickListner.
I follow the exact steps as told by tutor in videos .. I am using Android SDK 12 ,Eclipse Indigo and working on Gingerbread 2.3.3. Any solution in this regard would be appreciated

Possible situations:
Make sure you imported android.widget.Button
"Button b = (Button) findViewById(android.R.id.button1);"
Usually it is called:
"Button b = (Button) findViewById(R.id.button1);"
if you have defined the button correctly in the main.xml file. Also make sure you are not importing android.R
I suppose it is a typo but it is actually written setOnClickListener()
Cheers

Related

Vapor, why is drop.config nil

swift code:
let drop = Droplet()
print(drop.config)
result:
▿ Config
▿ node : Node
- object : 0 elements
why is drop.config nil
saying it works once you delete the secrets folder leads me to believe your using xcode and added the files directly through xcode. If this is the case, you should get the folder structure back to its original condition. Once its working properly, add the new files/folders outside of xcode, I add mine using Atom but text editor of your choice will work fine, then save the texteditor file and they will show up in your xcode project and work as expected with drop.config.
1) navigate to project folder using command
2) if using atom, type "atom ."
3) add the new files/folders and hit control + S to save
should be good to go from there
To be safe, make all future adjustments to files in texteditor as well.
This is happening only on 3.1 because swift changed a folder with the dependencies and the vapor can not find working directory.
https://github.com/vapor/vapor/blob/1.5.15/Sources/Vapor/Droplet/Droplet%2BWorkingDirectory.swift
You should upgrade to the Vapor 1.5

Localization Issue in IOS Swift to change langue on button Click

I have tried to follow the below link to achieve localization .
Tutorial
It seems not working ( only English text appears )
My requirement is to change the label/button texts etc. to be changed from English to Arabic language and vice-versa on a button click inside the App.
I have already have a translated Arabic strings available from the client so I dont have to use a translation ( import/export - xliff) . Created 2 string files for English and Arabic separately and calling it ViewDidload() event checking the User had opted for Arabic/English Version.
Please note that I'm trying load the languages dynamically when user clicks button inside my app . Not by changing the device language .
For ex:
Localizable.string ( en)
"Details" = "Details";
Localizable.string(ar)
"Details" = "التفاصيل " ;
retrieval:
btnDetail.setTitle(NSLocalizedString("Details", comment: "More Details"), forState: .Normal)
But its showing only english but not Arabic when I call in buttonclick event to change to Arabic.
Please help. I m new to IOS and Swift.

Hyperlinks without file://... with openpyxl to open a ws from the same wb?

I want open ws2 inside the same libreoffice wb with a hyperlink in a cell on ws1.
My code is:
wb["test"].cell(row = 1, column = 2).hyperlink = '#%s' % "test2"
This works, but openpyxl adds file://... to the link and a new instance of libreoffice starts (and auto close) with every click on my hyperlink.
If i add manually a hyperlink to libreoffice calc no file:// is added and no other instances of libreoffice starts.
What target_modes are supported?
I believe target_mode = "External is hard coded inside the openpyxl cell hyperlink attr. wb.cell()._hyperlink_rel.target_mode = "External
It's fair to say that support for hyperlinks isn't perfect. However, starting with version 2.3 there is at least full support for the type. The relevant code for serialising could easily be adapted to reflect this.

Xcode adds ".app" to target names ending with ".cc"

Can anyone fix or confirm this behaviour in Xcode (6.3.2):
Ending the name of an iOS project target with ".cc" like "something.cc" automatically adds ".app" to end of the name at runtime…?!
something.cc -> something.cc.app
This is now confirmed by others and obviously a bug: http://openradar.appspot.com/21319069
Thanks to Paul Hemetsbeger there is a workaround: Using the unicode letter "․" fixes the problem. Only the "delete this app alert view" gets a little bit messed up…

Localize iOS App name in Unity

I'm'developing a Unity3D game that shows a different (localized) app name in the iPhone's home screen according to the user local language. Note that:
I already know how to localize the iOS app name by editing the Xcode project (create a InfoPlist.string file, localize it, add the CFBundleDisplayName key to it, etc.)
I also know how automatically localize an Android app name within the Unity editor (add a values-XX.xml file with the app_name property onto Assets/Plugins/Android/res/ folder, etc.)
The question is: how can I automatically localize my iOS app name within the Unity Editor so that I don't need to perform the error-prone task 1. every time I build the project?
I think that PostprocessBuildPlayer should be the way to go, however I haven't found any documentation on how to parse it and/or modify the Xcode project file correctly to achieve this.
Long time ago I ran into trouble when I tried to modify info.plist via the Build Player Pipeline especially when doing it in Append mode. It works only once and then subsequent builds fail with "The data couldn’t be read because it isn’t in the correct format." (s. Unity forum posts like this one and my blog posting about this problem) So I decided to take the alternative way combining a customised build with an Xcode Build Pre-action.
Three steps are required:
(1) Xcode setup:
In Xcode go to Edit Scheme / Build / Pre-actions. Then click the + sign to add a New Run Script Action.
In Provide build settings select Unity-iPhone.
Paste . ${PROJECT_DIR}/modify_info_plist.sh (note the dot and blank at the beginning, is ensures that the script is executed in the caller's shell)
So it should look like this:
(2) Script modify_info_plist.sh:
Within your script you have access to all environmet variables from Xcode (s. Xcode Build Setting Reference) and you can manipulate Info.plist using the defaults command (man page). Here is a sample I used to add gyroscope to the UIRequiredDeviceCapabilities:
# Code snippet used in Unity-iPhone scheme as "Build Pre-Action"
my_domain=${PROJECT_DIR}/Info.plist
status_bar_key=UIViewControllerBasedStatusBarAppearance
logger "Start adding keys to info.plist"
defaults write $my_domain $status_bar_key -boolean NO
if [ `defaults read $my_domain UIRequiredDeviceCapabilities | grep "gyroscope" | wc -l` = "0" ]; then
defaults write $my_domain UIRequiredDeviceCapabilities -array-add "gyroscope"
fi
logger "Keys added to info.plist successfully"
(3) Build Pipeline:
Put the following code in a static editor class to create a new menu item Tools / My iOS Build with shortcut cmd+alt+b:
static string IOSBuildDir= "Develop";
[MenuItem("Tools/My iOS Build %&b")]
public static void IOSBuild () {
string[] levels = { "Assets/Scenes/Boot.unity",
"Assets/Scenes/Level-1.unity",
// ...
"Assets/Scenes/Menu.unity"
};
string path = Directory.GetCurrentDirectory ();
path += "/" + IOSBuildDir + "/Info.plist";
if (File.Exists (path)) {
Debug.Log ("Removing file " + path);
File.Delete (path);
}
BuildPipeline.BuildPlayer (levels, "Develop", BuildTarget.iPhone,
BuildOptions.AcceptExternalModificationsToPlayer);
}
I know this is no perfect solution but it's the only one I found to work stable. Two drawbacks:
Step (1) has to be repeated after major Xcode format changes
New scenes have to be appended in the editor class code in step (3)

Resources