last day (14 days later) » 

11:35 AM
0
A: how to scale the image color according to value

Yves DelermYou need to use a Clip drawable. See here : http://developer.android.com/guide/topics/resources/drawable-resource.html#Clip For instance in your code : private void displayData(String data) { if (data != null) { battery.setText(data); int x=Integer.parseInt(battery.getText().to...

 
i got error while applying this code
 
Which error do you get ? This is approximate code to give you an idea of how to do it. For instance the ImageView must be called image_level and not image
 
i got error at line drawable.setLevel(x);
 
Could you please give me the stack trace of the error ?
 
ok i will paste errors wait
04-11 06:01:05.425: E/AndroidRuntime(7852): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041) 04-11 06:01:05.425: E/AndroidRuntime(7852): at dalvik.system.NativeStart.main(Native Method) 04-11 06:01:05.425: E/AndroidRuntime(7852): Caused by: java.lang.NullPointerException 04-11 06:01:05.425: E/AndroidRuntime(7852): at com.incipio.brv_powerbank.DeviceControlActivity.displayData(DeviceControlActivit‌​‌​y.java:550)
04-11 06:01:05.425: E/AndroidRuntime(7852): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.example.bluetooth.le.ACTION_DATA_AVAILABLE flg=0x10 (has extras) } in com.incipio.brv_powerbank.DeviceControlActivity$2@43157908 04-11 06:01:05.425: E/AndroidRuntime(7852): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:778)
 
11:35 AM
I think the error was on the ImageView, I modified the sample, please try again with that
 
ok yves wait.i am doing
hi yves, i done but i got only a thin line from left to center of screen and image is also not visible.
<RelativeLayout android:id="@+id/image_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:layout_below="@+id/linearlayout" android:background="#ffffff" > <ImageView android:id="@+id/image_level" android:background="@android:color/holo_red_dark" android:src="@drawable/clip" android:layout_height="wrap_content" android:layout_width="200dp" android:contentDescription="@string/app_name"/> </RelativeLayout>
 
Hello, you can modify that with android:layout_height and android:layout_width properties. See my new example
 
ok i will try and say wait.
 
I my answer solves your problem, please mark it as accepted :)
 
hi yves,very gd mrg.i solved my problem by above answer.urs also good but i got only single line so i try like above.please check it.
 
11:35 AM
It is a bit hard for my answer, as I made the main part of the work and you were able to write your solution from mine. The main goal of this forum is to get help, not to get all the work done. At least could you upvote my answer please ?
 
ok yves i will vote but i did like i uploaded.but i am sorry itry u answer also.
hi yves,if u r free and dont mind please check this link stackoverflow.com/questions/23053164/…
hi yves r u happy and thanks to help me.please check this link stackoverflow.com/questions/23053164/…
hi yves, r u there
 
Yes, I just gave a look to your other problem, but I do not have much time. I hope the comment I made will help
 
then wht about remaining thing yves i should get name,address,and 2 toggle buttons state.so retriving these all and in middle of app it should check with address and retrive those values only.so i done using database.
hi yves,i added screenshot please check this link stackoverflow.com/questions/23053164/…
hi yves please check and answer the above link i added screenshot also.later if u free please help me.
 
12:34 PM
hi yves
 

last day (14 days later) »