Images does not shown on Mvx.MvxImageView (Android) - android

I am trying to learn mvvmcross and I am a newbie now. I started to watch N + 1 days of MvvmCross video series and I am stuck at N = 2 Kittens and Lists. I add DownloadCashPlugin and FilePlugin to the project and create Mvx.MvxImageView as shown on the video but when I start my app(both simulator and android device), everything is same but images does not shown or not downloaded. I open permission from android manifest and I have an internet connection on my android device. I am pretty sure I follow videos carefully and dont miss any part.
I am using Visual Studio 2013 Communtiy Edition and MvvmCross is last updated version. I will be glad if anyone can help me on this problem. Thank you.
Item_Kitten.axml ;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Mvx.MvxImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_margin="10dp"
local:MvxBind="ImageUrl ImageUrl" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Text Name" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="30dp"
local:MvxBind="Text Price" />
</LinearLayout>
</LinearLayout>

Related

App not working in android studio

I have made my first hello world program in android studio and when I launched for the first time (without any images), it was working . But when I put a photo using imageview then when I created the apk it doesn't run saying that the app has stopped working.
following is the code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.himan.helloworld1.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello Himan"
/>
<TextView
android:layout_width="50dp"
android:layout_height="50dp"
android:text="From Rakesh"
/>
<ImageView
android:src="#drawable/happy_birthday"
android:layout_width="500dp"
android:layout_height="500dp" />
</RelativeLayout>
You can see Video tutorial here
Android Hello World Example
Android Tutorial For Beginners - https://youtu.be/-Cfl6BdLT5K

Possible reason for listview not displaying on Android 4.0.3 (API 15) but works fine on 4.1.2 (API 16)?

I am tasked with determining why a 5 year old app (worked on by a few teams) that supports API 8 through API 19 only has this particular issue with API 15.
The issue is the app is not displaying any data in it's 2 ListViews.
A few details:
There are no errors reported in logcat. I run the app on both API 15 and API 16 emulators and their logcats look almost identical.
Calling listview.getAdapter().getCount() does return an expected value greater than 0.
(UPDATE)
3. listview.getItem() and listview.getView() are NOT being called.
listview.getVisibility() does return View.VISIBLE
Oddly, backing out of the app and restarting it, allows the data to display(!)
I have searched for several days now on what could be the cause of this working fine on API 16, as in "what was fixed" between 15 and 16, but nothing that makes sense showed up. I have been shy to ask here due to this making me sound crazy :-)
I'm hoping someone has encountered this with 4.0.3 and can give me my next path to solve this. Posting code will be very difficult, but any reasonable requests will be happily complied with. Thanks!
No one is going to believe me ;-), but the fix was to remove:
android:animateLayoutChanges="true"
...from a LinearLayout in the app's main layout file (which contains a support ViewPager and whose root was a TabHost, not that those necessarily matter).
I couldn't believe this myself, so I replaced and removed it a couple of times and it would alternate between "breaking" and "working".
I have no idea why this worked, but I've listed the .xml file here
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/aim_light_grey" >
<!-- android:animateLayoutChanges below was the problem!!! -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false"
android:animateLayoutChanges="true"
android:orientation="vertical">
<LinearLayout
android:id="#+id/no_network_indicator"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/warn_gray" />
<TextView
android:id="#+id/tv_not_connected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="#color/light_grey"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:text="#string/not_connected"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="44dip"
android:layout_weight="0"
android:background="#color/blue"
android:visibility="gone" >
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="#string/image_logo_accessibility_description"
android:src="#drawable/action_1" />
<TabWidget
android:id="#android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</LinearLayout>
</TabHost>

Android TextView top image not rendering properly on 2.3

When I run my android application in Android version >=4 I got this out put(I didn't tested in android version 3):
When run the same application in android version 2.3 I got a bit different output:
You can see in second screenshot the image for about button is not visible. But when I try run the same application several times on 2.3 some times I got about image visible.Here is my code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="#layout/actionbar_with_right_button" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scrollbars="none" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:drawablePadding="#dimen/settings_text_view_drawable_padding"
android:drawableTop="#drawable/snooze_button"
android:gravity="center"
android:onClick="showRemainderSnoozeSettings"
android:padding="#dimen/settings_text_view_padding"
android:text="#string/snooze" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:drawablePadding="#dimen/settings_text_view_drawable_padding"
android:drawableTop="#drawable/help_button"
android:gravity="center"
android:onClick="showFaq"
android:padding="#dimen/settings_text_view_padding"
android:text="#string/help" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:drawablePadding="#dimen/settings_text_view_drawable_padding"
android:drawableTop="#drawable/about_button"
android:gravity="center"
android:onClick="showAbout"
android:padding="#dimen/settings_text_view_padding"
android:text="#string/about" />
</LinearLayout>
</ScrollView>
I didn't understand why this is happening.
Can anyone help me to solve this issue.
Edit :
One more important thing I forgot to mention when I changed android:drawableTop="#drawable/about_button" to android:drawableTop="#drawable/help_button" of about TextView. It worked perfectly. So it can be an issue of my about_button image. So I recreated the about image again and put in all drawable folder. Even after that also I didn't get any +ve result. This issue only in 2.3 or less.
Thanks
May this help you:
Seems like this is a bug with android, where sometimes the first image in the drawable folder doesn't get displayed.....
I had a similar bug - a particular drawable was not being displayed, no matter in what ImageView. So I Added a dummy image called aaaa.png to the drawable folder and problem was solved....

LinearLayout - How to get text to be on the right of an icon?

Bit of a newbie when it comes to android, only been working on it properly for a few days but even after all the searching I've done im stumped and nobody seems to know how to help me. I have this so far:
http://img263.imageshack.us/i/sellscreen.jpg
How can I move the text to be besides each icon rather than underneath it? Hoping the gallery won't be moved either. Here is the code i have:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="#+id/test_image"
android:src="#drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="The offcial UK driving theory test application. Over 190 questions."
/>
<ImageView
android:id="#+id/test_image"
android:src="#drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="The offcial UK driving theory test application. Over 190 questions."/>
<ImageView
android:id="#+id/test_image"
android:src="#drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="The offcial UK driving theory test application. Over 190 questions."/>
<ImageView
android:id="#+id/test_image"
android:src="#drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="The offcial UK driving theory test application. Over 190 questions."/>
<ImageView
android:id="#+id/test_image"
android:src="#drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="The offcial UK driving theory test application. Over 190 questions."
/>
</LinearLayout>
</ScrollView>
Top half of my code doesn't seem to be showing for some reason but it's just the opening of the linear layout.
I will be forever grateful to anyone that can help, i've been racking my brains for days and getting nowhere. Really getting stressed out by it. Thanks in advance!!
You need to wrap each ImageView/TextView pair in a linearlayout
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/test_image"
android:src="#drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="The offcial UK driving theory test application. Over 190 questions."
/>
</LinearLayout>
It's also pretty clear that you didn't ask anyone who knew android, because this is pretty trivial.
Have you read through the android layout tutorials? Lots of stuff on the dev site, like declaring layout, common layout objects, and the hello views tutorials.
There are a number of ways to accomplish this, depending on your goals.
Is it a list of items of unknown size that may want to scroll? Use a ListView. You can provide a custom layout to the ListView with your things side by side.
Do you have a finite set of things? Use a RelativeLayout. Tell each TextView to layout below the one above, and each ImageView to layout to the right of it's TextView.
You could also accomplish that with nested LinearLayouts, one vertical and a bunch of horizontal, but that is less efficient than using a RelativeLayout.

Internal link to TextView in Android?

I find myself stuck in something I think would be really easy to solve. My app contains a lot of TextViews and ImageViews, and one TextView contains the content listed. I want each element of the displayed content internally linked to the respective TextView. Probably the TextView isn't the right element to use, but I have trouble finding the right element.
The internal link should work exactly like internal links in html-documents... is this possible to achieve in Android?
strings.xml:
<string name="c3">3. Contents</string>
<string name="c4">1. Abstract
\n3. Contents
\n4. List of Abbreviations
\n5. Introduction
\n6. Materials & Methods
\n6.1 Literature Selection
\n6.2 Method
\n6.3 What is Android?
\n6.3.1 Dalvik Virtual Machine and Android Applications
\n6.3.2 Android Structure, Java and XML
\n6.3.3 Android Versions
\n6.4 The Development Environment
\n6.4.1 Android SDK
\n6.4.2 Eclipse IDE
\n6.4.3 Android Virtual Device
\n6.4.4 Secure Digital Card
\n6.5 “Hello World!” as Test of IDE
\n6.6 Test Application
\n6.7 Developing Strategy
\n7. Result
\n7.1 Facebook Connect
\n7.1.1 Facebook Application
\n7.1.2 Facebook Connect for Android
\n7.2 Networking
\n7.3 Data Synchronization
\n8. Discussion
\n9. Conclusion
\n10. References
\n10.1 Internet References
\n10.2 Lecture References\n\n
</string>
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/smoke"
android:scrollbars="vertical"
>
<ScrollView android:id="#+id/ScrollView01"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:scrollbars="none"
>
<LinearLayout android:id="#+id/LinearLayout02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="4px"
android:paddingRight="4px"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/a"
android:textColor="#color/black"
android:gravity="center_horizontal"
android:textSize="16dp"
android:paddingBottom="2dp"
android:paddingTop="20dp"
android:scrollbars="vertical"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/b"
android:gravity="center_horizontal"
android:textColor="#color/black"
android:scrollbars="vertical"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/c1"
android:textColor="#color/black"
android:textSize="20dp"
android:paddingBottom="2dp"
android:scrollbars="vertical"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/c2"
android:textColor="#color/black"
android:scrollbars="vertical"
/>
If I were you, I'd convert your content into HTML with internal links and use a WebView to display it. I have no idea how you would pull off what you are trying to do any other way. Moreover, that's the typical approach used for ebooks, which appears to be what you are trying to create.

Categories

Resources