Android Button Event - Android Studio

Hey everyone
Iam new here and in android programing.
So iam working on some assignment that i got in class which i need to build
an app with 3 buttons one to add an event one to show all events and one to delet(the delet one is not must to do).
ive build all the buttons and now i want to work on the button add event so when i clicked on him he will lead me to new page which there i will have text
boxes when i can fill information and etc...
and when i will clicked on show all event its will lead me into new page which will print all the events i have in the Arraylist till now.
i know i need to do it all in the main activity but how i do that from where i should extends?
Thank you Adi

You have to initialize the Button ypi have added in the activity
Then set an OnClickListener
Sent from my GT-I9195 using XDA Free mobile app

adids1221 said:
Hey everyone
Iam new here and in android programing.
So iam working on some assignment that i got in class which i need to build
an app with 3 buttons one to add an event one to show all events and one to delet(the delet one is not must to do).
ive build all the buttons and now i want to work on the button add event so when i clicked on him he will lead me to new page which there i will have text
boxes when i can fill information and etc...
and when i will clicked on show all event its will lead me into new page which will print all the events i have in the Arraylist till now.
i know i need to do it all in the main activity but how i do that from where i should extends?
Thank you Adi
Click to expand...
Click to collapse
Look at our code https://github.com/MOSP-Development/android_mosp_SFNote_package
Sent from my SM-G530H using XDA Free mobile app

hello
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
-----------
button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {/* Some Code */ });
button1 is created on an android layout you refer to (main.xml) :

Related

[Q] Captivate - framework issue

Hi All,
I am a Android developer need quick help on a strange issue with Samsung Captivate. I use android:windowSoftInputMode="adjustPan" for an activity which has a list of EditText in it. The page can expand by adding more EditText views, when it grows long and onFocus of last field soft keyboard pops up and the activity doesn't completely push up. So the EditText view falls behind the soft keyboard.
The strange thing is same the activity moves up for all other Android devices like HTC Aria, Xeperia, etc. Only Samsung Captivate doesn't move up completely, not sure why its device specific.
With regards,
Visva

Hot Keys

Is there a way to set up hot keys for the keyboard to open specific apps?
What do you mean by hot keys?
Yes, there is a way to do this in combination with the menu key. It comes with the phone where you can press menu+key and do certain things...I've found it before, but I can't seem to do so now.
go to settings>aplications>quick launch
ex:a set to alarm
press and hold search button on keyboard a
vala alarm open.
feel free to hit thanks lol
I would rather make my own hotkeys. Ex. MENU + ENTER completes a url, MENU + W turns WiFi on or off, etc.
Sent from my DROID3 using XDA App
Exactly, i want to be able to configure certain combinations of keys to open specific apps is that possible?
Sent from my XT860 using XDA App
aznproto said:
Exactly, i want to be able to configure certain combinations of keys to open specific apps is that possible?
Sent from my XT860 using XDA App
Click to expand...
Click to collapse
Yes, through the above method in the applications sub-menu. Search hard key plus a letter or number key of choice boots an app. For me...
search+...
b = browser
h = handcent
l = flashlight
t = twitter
f = facebook
c = camera
p = poweramp
s = screenshot
y = youtube
Since I function on a 3rd grade level, mine all match up with what they do.

[Help]Accessing resource from a replaced layout?

Hey guys!
I wanted to add a new imagebutton to the stock app's layout, so I modified it adding the said imageb. . Now I want to access it to add an onClickListener to it, but whenever I try to access it I get a Null Pointer Exception. (Accessing with
layoutInflatedParam.view.findViewById( layoutInflatedParam.res.getIdentifier(*name of the new imageb.*, "id", *packagename of the app*)); )
My question is that what is the correct way accessing the newly added ImageButton?
Thanks for reading thru!
Sent from my GT-I9305 using XDA Free mobile app
You should provide more info on how you added that button to the layout.
If you created an instance of button dynamically in inflate layout hook, and added it using addView to the layout, one of the possibility
is to set some tag of that button instance (setTag method). You can later find it using findViewWithTag instead of findViewById.
C3C076 said:
You should provide more info on how you added that button to the layout.
If you created an instance of button dynamically in inflate layout hook, and added it using addView to the layout, one of the possibility
is to set some tag of that button instance (setTag method). You can later find it using findViewWithTag instead of findViewById.
Click to expand...
Click to collapse
Simply grabbed the layout from the original apk and added the imageview to it, then I forward the original one to my midified one with initPackageResourcesParam.res.setReplacement.
Sent from my GT-I9305 using XDA Free mobile app
I don't have experience with replacing whole layouts but have you tried:
layoutInflatedParam.view.findViewById(R.id.idOfMyButton) ?
C3C076 said:
I don't have experience with replacing whole layouts but have you tried:
layoutInflatedParam.view.findViewById(R.id.idOfMyButton) ?
Click to expand...
Click to collapse
Thanks, it worked!
Sent from my GT-I9305 using XDA Free mobile app

EditText and put it to ListView

I'm kinda new to Android Studio so I will be grateful if you can help me with my question. How can I enter some text and add it to a ListView with the use of a Bundle?
For example, say I enter a name in the EditText component in the MainActivty, and then when I press the OK button, it will be seen in to another Activity in a List View.
I've been using Bundles to transfer text to another Activity but I can't figure out how to transfer text to ListView.
Soshiron said:
I'm kinda new to Android Studio so I will be grateful if you can help me with my question. How can I enter some text and add it to a ListView with the use of a Bundle?
For example, say I enter a name in the EditText component in the MainActivty, and then when I press the OK button, it will be seen in to another Activity in a List View.
I've been using Bundles to transfer text to another Activity but I can't figure out how to transfer text to ListView.
Click to expand...
Click to collapse
Well this one is a bit tricky but nothing out of the ordinary. You know how to pass data between activities using bundle and intents. Now what you have to do is retrieve the string you want from the bundle. Update your array or List that holds the info for your listview and call notifydatasetchanged() on your listview adapter.
If you need more help let me know

Click with tasker on Element

Hello,
I try to make a little automation for a app.
It works via Execute shell "input tap x y"
but now i have a big problem, on different screensresolutons the button had other positions.
so i made a task that calculate the position based on your screenresolution.
now i have a even bigger problem. Same screenresolution, other phone, other position.
I found some samplecode, but i don't know how to put this in tasker, or if this even works.
driver.findElementByName("SignIn").click();
public void tap(int index){
List<WebElement> li = driver.findElementByClass("PUT YOUR class name");
li.get(0).click();
}
There is a plugin called AutoInput.
See if that works for you.
(Note: it doesn't work on webview based apps)
Autoinput doesn't work. I'm new, i had to split the link i mg u r . c om /jWrlAVI
I want to export the app as APK, so plugins won't work.

Categories

Resources