Noob App Development - Java for Android App Development

I've just started developing my first app a couple weeks ago, I learned coding in flash and with HTML(not 5).
I'm developing an aggregator app to help you check stuff on your device faster.
I am completly stuck on the simpliest thing, I need to know how to properly add @string's to my XML for buttons, etc. and how to add to the strings file so I dont get those warnings.
Also I want to know how to add a new activity to my project without deleting the MainActivity's "strings" file.
Thank you so much to anyone who can guide me!! I need this app done for me to get a passing grade in my class. Whoever helps gets my apps free for life when i'm a puplisher. Thank you so much!!
Sent from my HUAWEI-M835 using xda app-developers app

Ok.
Add a string this way:
Code:
<string name="[name goes here]">[the string]</string>
(Add this in the strings.xml file in the res/values directory.)
Then in your app you can get it this way:
Code:
String s = getString(R.string.[name goes here]);
Set the text in the xml file that way:
Code:
<Button ...
android:text="@string/[name goes here]"
... />
Add the Activity the normal way. You do not need a second strings.xml file. Just add it to the old one. One for everything.

That helps alot, but,
But whenever I add the @string/ before the text it changes the button name on the visual editor to @string/...."
Also when I added a new activity it replaced my strings file, deleting what I thought was proper strings.
Sent from my HUAWEI-M835 using xda app-developers app

crazy4creationstudios said:
That helps alot, but,
But whenever I add the @string/ before the text it changes the button name on the visual editor to @string/...."
Also when I added a new activity it replaced my strings file, deleting what I thought was proper strings.
Sent from my HUAWEI-M835 using xda app-developers app
Click to expand...
Click to collapse
Which revision of the Android SDK do you have? Updating might help.
Could you please post some pieces of your code which do not work (just the important parts, you can change the names etc.)?

Also im using the SDK and IDE from Google (Eclipse).
And Java JDK
Sent from my HUAWEI-M835 using xda app-developers app

crazy4creationstudios said:
Also im using the SDK and IDE from Google (Eclipse).
And Java JDK
Sent from my HUAWEI-M835 using xda app-developers app
Click to expand...
Click to collapse
Eclipse has not been created by Google. But this does not matter.
Which version of the SDK did you install? (To check this and whether updates are available open the SDK manager. You might need to do this as an administrator.)

I don't know, i'll check in a few minutes at lunch. I downloaded it about 2 weeks ago.
I'll post the codes then too.
Btw none of the code is custom it is from Eclipse when I used the GUI tools
Sent from my HUAWEI-M835 using xda app-developers app

nikwen said:
Eclipse has not been created by Google. But this does not matter.
Which version of the SDK did you install? (To check this and whether updates are available open the SDK manager. You might need to do this as an administrator.)
Click to expand...
Click to collapse
I know but developer.google.com includes it with the ADT bundle.
And I meant to send that b4 u replied haha
Sent from my HUAWEI-M835 using xda app-developers app

Codes
nikwen said:
Which revision of the Android SDK do you have? Updating might help.
Could you please post some pieces of your code which do not work (just the important parts, you can change the names etc.)?
Click to expand...
Click to collapse
Im using API level 17 the Rev. is 2 im using the latest version for x86 systems (32-bit)
My strings file looks like this:
<resources>
<string name="title_activity_socialpage1">Socialpage1</string>
<string name="action_settings">Settings</string>
</resources>
And my Main xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="c4cs.try4.everydayagian"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="c4cs.try4.everydayagian.MainActivity"
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</activity>
<activity
android:name="c4cs.try4.everydayagian.Socialpage1"
android:label="@string/title_activity_socialpage1"
androidarentActivityName="c4cs.try4.everydayagian.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="c4cs.try4.everydayagian.MainActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And finally, my Activity_main's XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidaddingBottom="@dimen/activity_vertical_margin"
androidaddingLeft="@dimen/activity_horizontal_margin"
androidaddingRight="@dimen/activity_horizontal_margin"
androidaddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="32dp"
android:text="Web" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button1"
android:layout_alignParentRight="true"
android:layout_marginRight="46dp"
android:text="Social" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="41dp"
android:text="To Do" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/button3"
android:layout_alignBottom="@+id/button3"
android:layout_alignRight="@+id/button2"
android:text="News" />
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/button3"
android:layout_below="@+id/button3"
android:layout_marginTop="48dp"
android:text="Weather" />
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button5"
android:layout_alignRight="@+id/button4"
android:text="Button" />
</RelativeLayout>

crazy4creationstudios said:
Im using API level 17 the Rev. is 2 im using the latest version for x86 systems (32-bit)
My strings file looks like this:
<resources>
<string name="title_activity_socialpage1">Socialpage1</string>
<string name="action_settings">Settings</string>
</resources>
And my Main xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="c4cs.try4.everydayagian"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="c4cs.try4.everydayagian.MainActivity"
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</activity>
<activity
android:name="c4cs.try4.everydayagian.Socialpage1"
android:label="@string/title_activity_socialpage1"
androidarentActivityName="c4cs.try4.everydayagian.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="c4cs.try4.everydayagian.MainActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And finally, my Activity_main's XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidaddingBottom="@dimen/activity_vertical_margin"
androidaddingLeft="@dimen/activity_horizontal_margin"
androidaddingRight="@dimen/activity_horizontal_margin"
androidaddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="32dp"
android:text="Web" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button1"
android:layout_alignParentRight="true"
android:layout_marginRight="46dp"
android:text="Social" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="41dp"
android:text="To Do" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/button3"
android:layout_alignBottom="@+id/button3"
android:layout_alignRight="@+id/button2"
android:text="News" />
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/button3"
android:layout_below="@+id/button3"
android:layout_marginTop="48dp"
android:text="Weather" />
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button5"
android:layout_alignRight="@+id/button4"
android:text="Button" />
</RelativeLayout>
Click to expand...
Click to collapse
What is the exact name of your strings file and where is it located?
Where are the problems in the rest of the code?

try right clicking the button or textview from the graphical layout page of your xml. then go to edit text and click on project resources at the top. this should list all the strings that you have. you can choose a string that you have already made or you can click the new string button to create a new string directly from there.

In the "res" folder directory near "layout", where Eclipse puts it automatically.
The other errors were in the manifiest becuase I had ".r" in some wrong places (wich I dont get becuase I never did it in the first place
Sent from my HUAWEI-M835 using xda app-developers app

crazy4creationstudios said:
In the "res" folder directory near "layout", where Eclipse puts it automatically.
The other errors were in the manifiest becuase I had ".r" in some wrong places (wich I dont get becuase I never did it in the first place
Sent from my HUAWEI-M835 using xda app-developers app
Click to expand...
Click to collapse
What does "near layout" mean? Is it in the res/value folder? And is the file called "strings.xml"?

Yes, I just checked
Its in the res/values folder named strings.xml
Sent from my HUAWEI-M835 using xda app-developers app

nikwen said:
What is the exact name of your strings file and where is it located?
Where are the problems in the rest of the code?
Click to expand...
Click to collapse
Did you see that?

nikwen said:
Did you see that?
Click to expand...
Click to collapse
Yeah. The other problems I was having are:
My Manifiest has some incorrect snippets that I didnt add involving action settings(?) Check my strings it was one from it
Sent from my HUAWEI-M835 using xda app-developers app

crazy4creationstudios said:
Yeah. The other problems I was having are:
My Manifiest has some incorrect snippets that I didnt add involving action settings(?) Check my strings it was one from it
Sent from my HUAWEI-M835 using xda app-developers app
Click to expand...
Click to collapse
It was one from it? Which one? We cannot tell what is wrong with your app if we do not get enough information. You know where the error occurs. If you want help, provide us the information we need.
It has got nothing to do with that, but it is still something to correct: In the line
Code:
android:value="c4cs.try4.everydayagian.MainActivit y" />
there is a space between Activit and the y. Remove the space.

Ill find some more specific sections when I have the class tommorrow and PM it to you.
Sent from my HUAWEI-M835 using xda app-developers app

crazy4creationstudios said:
Ill find some more specific sections when I have the class tommorrow and PM it to you.
Sent from my HUAWEI-M835 using xda app-developers app
Click to expand...
Click to collapse
Great.

Set the android:targetSdkVersion to 17 in your manifest
Envoyé depuis mon CINK SLIM avec Tapatalk

Related

[How to] Merge current and ongoing notification [JB]

Hi xda friends
today i want to share a simple guide with you (How to merge ongoing and current notification) if you find any guide like this plz inform me.
Requirements:
- ApkMultiTools (search around xda and thanks tool developers)
- Notpad ++ (better for opening xml files)
OK let's start:
- Decompile SystemUI.apk
- Go to res\layout
- open tw_status_bar_expanded.xml with Notpad++
- find this line
Code:
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/onGoingItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
- Cut and paste just above this to line
Code:
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/notificationItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
- still on tw_status_bar_expanded.xml find this line:
Code:
<LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#ff293945" android:focusable="true" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
- Replace with this line:
Code:
<LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#ff293945" android:focusable="true" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="0.0dip">
- final your edited file should be like this:
Code:
<LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#ff293945" android:focusable="true" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="0.0dip">
<TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/onGoingNotificationText" android:paddingLeft="11.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/status_bar_ongoing_events_title" />
</LinearLayout>
<LinearLayout android:orientation="vertical" android:id="@id/notificationCart" android:background="#ff293945" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
<RelativeLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/latestNotificationText" android:paddingLeft="11.0dip" android:layout_width="180.0dip" android:layout_height="fill_parent" android:text="@string/status_bar_latest_events_title" android:layout_alignParentLeft="true" />
<TextView android:textSize="@dimen/status_bar_expanded_notification_clear_button_text_size" android:textColor="@color/tw_status_bar_clear_btn_text" android:gravity="center" android:id="@id/clear_all_button" android:background="@drawable/tw_btn_default_small" android:padding="0.100000024dip" android:focusable="true" android:clickable="true" android:layout_width="@dimen/status_bar_expanded_clear_button_width" android:layout_height="fill_parent" android:layout_marginRight="4.0dip" android:text="@string/status_bar_clear_all_button" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
</RelativeLayout>
</LinearLayout>
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/onGoingItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/notificationItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
</LinearLayout>
-recompile and push to system\app folder change permission to rw-r--r--
- Enjoy
Once more
Reserved
Hi could.you please take a screenshot after you have done the mod so I can see what it does thanks in advance
Sent from my Galaxy Nexus using XDA Premium 4 mobile app

Q..How To Add Volume Slider And Other Sliders In StatusBar??

Any Buddy Give A Guide
brightness slider
http://forum.xda-developers.com/showthread.php?t=2152370
other sliders decompile my systemui from this statusbar
http://forum.xda-developers.com/showpost.php?p=46189065&postcount=2
copy all the smali from
smali\com\b16h22\statusbar to your status bar
add the pngs you want to put next to the slider
recompile the apk and then decompile the new apk to add the pngs to the public.xml
find the public values for the pngs and change the values in the smali with the public values (the smali isnt big so its easy to scroll through each one to find the old value - for example my MediaVolumeSlider.smali is 0x7f020093 so change that value with the value from your public.xml for the name of your png)
you will then need to add a 2nd panel to your status bar - there are various guides but I used
http://forum.xda-developers.com/showthread.php?t=2315342
you can then add all the sliders to the 2nd panel by adding it to that panel xml file
for example quickpanel_quick_settings_space.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:gravity="center" android:orientation="horizontal" android:background="@drawable/status_bar_background" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="3.0dip">
<ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="wrap_content" android:overScrollMode="ifContentScrolls">
<LinearLayout android:gravity="center" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="System Brightness" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.lidroid.systemui.quickpanel.BrightnessSlider android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:paddingLeft="3.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_brightness" />
<SeekBar android:tag="slider" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" />
</com.lidroid.systemui.quickpanel.BrightnessSlider>
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Ringer Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.RingerVolumeSlider android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="System Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.SystemVolumeSlider android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Notification Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.NotificationVolumeSlider android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Media Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.MediaVolumeSlider android:layout_width="fill_parent" android:layout_height="40.0dip" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
marcussmith2626 said:
brightnless slider
http://forum.xda-developers.com/showthread.php?t=2152370
other sliders decompile my systemui from this statusbar
http://forum.xda-developers.com/showpost.php?p=46189065&postcount=2
copy all the smali from
smali\com\b16h22\statusbar to your status bar
you will then need to add a 2nd panel to your status bar - there are various guides but I used
http://forum.xda-developers.com/showthread.php?t=2315342
you can then add all the sliders to the 2nd panel by adding it to that panel xml file
for example quickpanel_quick_settings_space.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:gravity="center" android:orientation="horizontal" android:background="@drawable/status_bar_background" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="3.0dip">
<ScrollView android:id="@id/scroll" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="wrap_content" android:overScrollMode="ifContentScrolls">
<LinearLayout android:gravity="center" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="System Brightness" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.lidroid.systemui.quickpanel.BrightnessSlider android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:paddingLeft="3.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_brightness" />
<SeekBar android:tag="slider" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" />
</com.lidroid.systemui.quickpanel.BrightnessSlider>
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Ringer Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.RingerVolumeSlider android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="System Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.SystemVolumeSlider android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Notification Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.NotificationVolumeSlider android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Media Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.MediaVolumeSlider android:layout_width="fill_parent" android:layout_height="40.0dip" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
Click to expand...
Click to collapse
Thnx+pressed....
can you tell me how to add only volume/media volume slider only...i wanna add below the brightness slider....or i will add volume slider by adding slideable mods to it
Himan Boro said:
Thnx+pressed....
can you tell me how to add only volume/media volume slider only...i wanna add below the brightness slider....or i will add volume slider by adding slideable mods to it
Click to expand...
Click to collapse
copy MediaVolumeSlider.smali MediaVolumeSlider$2.smali MediaVolumeSlider$1.smali
from smali\com\b16h22\statusbar to your status bar (to same location)
add the pngs you want to put next to the slider to res/drawable-ldpi
recompile the apk and then decompile the new apk to add the pngs to the public.xml
find the public values for the pngs and change the values in the smali with the public values (the smali isnt big so its easy to scroll through each one to find the old value - for example my MediaVolumeSlider.smali is 0x7f020093 so change that value with the value from your public.xml for the name of your png)
add the following to which ever xml you want where you want the slider to be
Code:
<LinearLayout android:gravity="center" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Media Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.MediaVolumeSlider android:layout_width="fill_parent" android:layout_height="40.0dip" />
</LinearLayout>
you can remove the textview if you dont want any text above the slider and you can remove the linearlayout if you are adding to an existing linearlayout or you can leave it as it is to give it its own dependinig on how you want it to look
marcussmith2626 said:
copy MediaVolumeSlider.smali MediaVolumeSlider$2.smali MediaVolumeSlider$1.smali
from smali\com\b16h22\statusbar to your status bar (to same location)
add the pngs you want to put next to the slider to res/drawable-ldpi
recompile the apk and then decompile the new apk to add the pngs to the public.xml
find the public values for the pngs and change the values in the smali with the public values (the smali isnt big so its easy to scroll through each one to find the old value - for example my MediaVolumeSlider.smali is 0x7f020093 so change that value with the value from your public.xml for the name of your png)
add the following to which ever xml you want where you want the slider to be
Code:
<LinearLayout android:gravity="center" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textColor="#ffffffff" android:paddingLeft="3.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Media Volume" android:shadowColor="#aa000000" android:shadowDx="1.0" android:shadowDy="1.0" android:shadowRadius="1.0" />
<com.b16h22.statusbar.MediaVolumeSlider android:layout_width="fill_parent" android:layout_height="40.0dip" />
</LinearLayout>
you can remove the textview if you dont want any text above the slider and you can remove the linearlayout if you are adding to an existing linearlayout or you can leave it as it is to give it its own dependinig on how you want it to look
Click to expand...
Click to collapse
yes..i tryd d same method by myself ..all wer corect excpt the public.xml so i got fc
It works bro..n i edit some pngs n Linear lines ... how to remove that Square box..beside the volume slider.
Himan Boro said:
It works bro..n i edit some pngs n Linear lines ... how to remove that Square box..beside the volume slider.
Click to expand...
Click to collapse
its part of the smali I think so best to ask b16h22
it just locks the slider if its ticked so you cant accidently change it
marcussmith2626 said:
its part of the smali I think so best to ask b16h22
it just locks the slider if its ticked so you cant accidently change it
Click to expand...
Click to collapse
ok..bro let it be like tht only Thanx again

[Q]Dealing with fragments

Here is the xml
Code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
android:layout_weight="1"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="40.0dip"
android:background="#ffffffff"
android:id="@+id/progaction"
android:layout_weight="0.2"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_below="@id/container"
android:layout_alignParentBottom="true">
<TextView
android:gravity="center"
android:text="Level"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
/>
<SeekBar
android:gravity="center"
android:layout_weight="1"
android:id="@+id/seek"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/><TextView
android:gravity="center"
android:text="1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/prog"
/>
</LinearLayout>
</LinearLayout>
Framelayout with id=container contains the fragment used in the activity.
Now the problem is that how to can i get the value of the textView(id=prog) in a particular fragment.i am not able to do it
Error says that "this method cant be used for static context" for the following line
Code:
TextView prog=(TextView) findViewById(R.id.prog);
So please help me to get the value of textView in a fragment
Sent from my GT-S5570 using XDA Premium 4 mobile app
I think your need to call getActivity() first and after this perform activity.findViewById(R.id.prog):
HTML:
Activity a = getActivity();
TextView prog=(TextView) a.findViewById(R.id.prog);
well maybe the easiest way is to hold an instance of the textView in the fragment code, then have a public method to return that instance, so that in the main fragment activity you simply get an instance to the fragment then call the method ?
Have you tried this one? http://stackoverflow.com/questions/6495898/findviewbyid-in-fragment-android
danelab said:
I think your need to call getActivity() first and after this perform activity.findViewById(R.id.prog):
HTML:
Activity a = getActivity();
TextView prog=(TextView) a.findViewById(R.id.prog);
Click to expand...
Click to collapse
Thanks.it worked
nikwen said:
Have you tried this one? http://stackoverflow.com/questions/6495898/findviewbyid-in-fragment-android
Click to expand...
Click to collapse
This is to be used if textView is present in the XML inflated by the fragment itself .but my textView is in XML of mainactivity.
Anyways thanks for the answer.I got the solution
Sent from my GT-S5570 using XDA Premium 4 mobile app

[Q] How to insert admob in app help me

hi guys
could you help me to put the banner in my app.
I also followed the guides but I still can not insert
You might even see me lines of code please
thanks
what problem are you getting????
Atleast tell the problem or provide the code where you are facing problem.
Simple:
1) Install Google AdMob Ads SDK (you can use Android SDK Manager for that)
2) Add GoogleAdMobAdsSdk.jar to your project (Project Properties>>Java Build Path>>Add External JARs…)
3) In the Manifest add ACCESS_NETWORK_STATE and INTERNET permissions, and also an activity inside application tag, like that:
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".BillingSampleActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name="com.google.ads.AdActivity" />
</application>
4) Get Publisher ID from AdMob
5) Add banner to your layout
Code:
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="your_admob_publisher_id"
ads:loadAdOnCreate="true" />
Thats it!
GRYMALA said:
Simple:
1) Install Google AdMob Ads SDK (you can use Android SDK Manager for that)
2) Add GoogleAdMobAdsSdk.jar to your project (Project Properties>>Java Build Path>>Add External JARs…)
3) In the Manifest add ACCESS_NETWORK_STATE and INTERNET permissions, and also an activity inside application tag, like that:
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".BillingSampleActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name="com.google.ads.AdActivity" />
</application>
4) Get Publisher ID from AdMob
5) Add banner to your layout
Code:
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="your_admob_publisher_id"
ads:loadAdOnCreate="true" />
Thats it!
Click to expand...
Click to collapse
Nice answer! Thanks for this.

Cannot Remove Battery Percentage

Hello everyone!
I have been searching about this matter for a few days now but can't seem to find a solution for it.
I am running a Samsung Galaxy S5 (SCL23)
I have a modified stock version of Android Lollipop Touchwiz 5.0.
I have already Deodexed the whole ROM.
I have successfully decompiled the whole SystemUi.apk and recompiled it without any errors.
I can change the color of the battery percentage text in the colors.xml (<color name="battery_text_color">#ffff0000</color>)
It works flawless!
But what i cannot seem to do is to remove the battery percentage completely.
I have tried adding: android:visibility="gone"
In the files: msim_system_icons.xml & system_icons.xml
Code:
<TextView android:textSize="@dimen/battery_text_size" android:textColor="@color/battery_text_color" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="0.74" android:importantForAccessibility="no" android:fontFamily="sans-serif" android:layout_marginStart="@dimen/battery_text_marginStart" android:visibility="gone" />
But without any effect at all...
It just boots normally.
I have tried removing the "<TextView />" line completely.
But that just results in a SystemUI has stopped working on boot.
Is there anything i'm missing here?
Appreciating any kind of help!
Here is a full copy of msim_system_icons.xml & system_icons.xml
msim_system_icons.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center_vertical" android:id="@id/system_icons" android:layout_width="wrap_content" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.keyguard.AlphaOptimizedLinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" />
<LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="2.0dip">
<include android:id="@id/msim_signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="2.0dip" android:layout_marginEnd="@dimen/rssi_battery_gap" layout="@layout/msim_signal_cluster_view" />
<TextView android:textSize="@dimen/battery_text_size" android:textColor="@color/battery_text_color" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:importantForAccessibility="no" android:fontFamily="sans-serif" android:layout_marginStart="@dimen/battery_text_marginStart" android:visibility="gone" />
<com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width="@dimen/battery_icon_width" android:layout_height="@dimen/battery_icon_height" android:layout_marginBottom="@dimen/battery_icon_bottom_margin" android:layout_marginStart="3.0dip" />
</LinearLayout>
</LinearLayout>
system_icons.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center_vertical" android:id="@id/system_icons" android:layout_width="wrap_content" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.android.keyguard.AlphaOptimizedLinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:layout_width="wrap_content" android:layout_height="fill_parent" android:alpha="0.74" />
<LinearLayout android:gravity="center" android:orientation="horizontal" android:id="@id/signal_battery_cluster" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingStart="2.0dip">
<include android:id="@id/signal_cluster" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="2.0dip" android:layout_marginEnd="@dimen/rssi_battery_gap" layout="@layout/signal_cluster_view" />
<TextView android:textSize="@dimen/battery_text_size" android:textColor="@color/battery_text_color" android:layout_gravity="center" android:id="@id/battery_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="0.74" android:importantForAccessibility="no" android:fontFamily="sans-serif" android:layout_marginStart="@dimen/battery_text_marginStart" android:visibility="gone" />
<com.android.systemui.BatteryMeterView android:id="@id/battery" android:layout_width="@dimen/battery_icon_width" android:layout_height="@dimen/battery_icon_height" android:layout_marginBottom="@dimen/battery_icon_bottom_margin" android:alpha="0.74" android:layout_marginStart="3.0dip" />
</LinearLayout>
</LinearLayout>
In the latest LP firmware, there is a toggle switch in battery settings to remove the % from the status bar
*Detection* said:
In the latest LP firmware, there is a toggle switch in battery settings to remove the % from the status bar
Click to expand...
Click to collapse
Unfortunately that is not possible, since the latest update for SCL23 is LP 5.0 only.
Is it possible to add this switch by myself instead?
My idea is to locate the files that is controlling this number and just edit it away.
I'm still sitting here and fiddling with it, trying different things.
If anyone want some files from me just ask and i will post them.
I would really love to fix this, any other ideas?
It is LP 5.0 with the switch
I was thinking you could figure out what that switch changes, and add the code yourself
*Detection* said:
It is LP 5.0 with the switch
I was thinking you could figure out what that switch changes, and add the code yourself
Click to expand...
Click to collapse
I will try and look at a different ROM SystemUi and see if i can make any sense out of it.
Or maybe i will have to install The same ROM i have in a Emulator on my computer for quicker modding.
I just changed:
Dimens.xml
Code:
<dimen name="battery_text_marginStart">0.0dip</dimen>
<dimen name="battery_text_size">0.0dip</dimen>
Rebuilded.
Replaced the SystemUI, with 0644 permissions.
Also wiped Dalvik Cache & Cache.
And fixed permissions.
Restarted
To see if it will go away, i will see if it works tomorrow morning.
Its upgrading all the apps now and I've got to sleep.
Yay! That fixed it, the text is gone!

Categories

Resources