setContentView issue - java

I am going through some tutorials in some Ebooks and one of the tutorials is to create the game Crazy Eights. I am at the beginning of this tutorial. So far I have created the project, added some details in the Mainifest, and I have also created a custom view named "MyView". The activity is CrazyEightsActivity.
Ok so my problem is this: I am adding some to the screenshots below about this also.
This one is the Main Activity:
This is the custom view (MyView):
In the tutorial, it calls for us to modify our main activity to set our custom view as the content view. I have copied everything so far (the code) and this little problem isn't allowing me to see the app (as it is created so far, not even close to being done) in the emulator. I need some help. It is underlinning the setContentView(MyView) line, I got a red square around it to help identify it. It gives me two quick fix options which both don't work. Whenever I run it after that, the emulator says that the app stopped running and had to be forced closed.
I am stuck, I hope that someone can help me. I am really trying to get this done ASAP so I can move on to the next tutorial and start learning this stuff.

setContentView(new MyView(this));

Related

How to create a working ViewPager App?

I am trying to develop an application which would be a lot better if it had a clean ViewPagerUI. I dont need fancy menus (yet), all I want is that if I start my application It starts out as one relative Layout, and i can then swipe left and right to view two more Relative Layouts.
I have read, watched and studied tons and tons of tutorials in the past week, but they all seem to either be outdated, don't fit my needs (because they create new "pages" with a while/for loop, which is definetely not what i'm looking for), or are way to complicated/ leave out important information( i am a fresh developer, but I really don't want to give up) like the official guide on the android developers webpage.
I get that experienced developers can get a lot out of these tutorials, but I don't find them to be very informative for beginners/newbs.
Questions I asked myself while reading different guides are:
Which differernt java classes/ xml files do I need to create, and which code goes where?
How does the ViewPager know which Fragment I want to display on any page?
How can I add working, "connected" code to all three fragments?
To give you some helpful information:
The first page should display a chart
The second page contains edit texts, which add items to an array and thus to the chart on the first page on button click
The third page contains settings for the chart
I don't need ANY other pages/activities/main menus whatsoever. Only these three interacting pages.
I`ve found it to be the best option to go with relative layouts.
The second page should be the main page.
I am sorry if you think that my issue is dumb, but i am trying to create this app for over a week now, and i seem to not get any traction.
Thanks in advance!

How to make an Android application to run some UI element above other application?

Sorry if the title is it's not self explanatory.
I'm trying to make an application that can interact with other ones by adding them a graphic element in their UI.
Just like Google does with Google Translate new function.
You can see a graphic example here: EXAMPLE GIVEN
My questions are:
Is that even possible? (I guess it is)
Where can I start searching about this? I haven't seen anything in Androids Developer documentation. I really don't know how to search info about this.
Thank you all.
If you'd like to add a graphic element to your app, I suggest using the Toolbar widget (it's automatically added with the Basic Activity template). There's also the ActionBar, but I think the toolbar is preferred to use (newer).
You can get a better idea about it here.
https://blog.xamarin.com/android-tips-hello-toolbar-goodbye-action-bar/
http://www.101apps.co.za/index.php/articles/using-toolbars-in-your-apps.html/
As far as the behavior of the icons, you'll have to add your own logic to them. Intents (implicit/explicit) are one way to interact with other things.
I hope this helps push you in the right direction.

Fragment transition?

Any help would be great with my issue. Basically I'm using this tutorial and its a web view fragment. So I got rid of the WebView and made new activities. My issue is connection the activities with the drawer so then every thing goes to a different activity. Once again, any idea on how to do this would be helpful.
I would recommend this tutorial instead.
http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
I've used it and I have a functioning application at the moment. You can download the source, change the text and images if you'd like.

how to get android spellchecker framework working

I have tried getting the android spelling checker working
http://developer.android.com/guide/topics/text/spell-checker-framework.html
However cannot understand how to. The hello spellchecker will load up a blank activity whilst the service example does nothing.
They are accessible through the sdk examples.
Does anyone know how to use them?
It gives you a TextView of the words they have entered in the HelloSpellChecker and a few suggestions.
FIRST install the SampleSpellCheckerService and then install the HelloSpellChecker app. If it doesnt work the first time try making a minor change to the HelloSpellCheckerActivity(insert a comment or a clank space) and run it again, it works.

I have got my HelloListView app working from android.com what is the best way to add information

I wanted to make an app that you can select a country and it comes up with information about the country. I don't know that much about Java i'm hoping that this will help me learn more about java.
I would like this to be an android app
please help me
thanks
CS
edit: I am new to java so can you help me out and give me pointers on how to do this please.
Example: Lets say we have a listview that has the United States, Germany, and the UK
I already have the list view set up. How would i go about making a second view that would let me select the us and give basic information about it?
Unfortunately I am still a little unclear as to what you are asking but as far as I am aware the list view you create should be able handle clicks on it, so if you check out the ListView class in the android SDK there you will need to look for the onClick event you are after. Overload it and put in the code to create (I think you are asking for this) a second activity, to then show your selection. However that might be a bit complex so try and handle the click event first by perhaps a toast message. Then work your way up.
The second activity you could use to show information, or just create a dialog, or another full screen view to show the info.
I commend you for getting ListView to work without knowing Java. I would suggest you learn the language first before jumping into Android apps because the development resources assume that you have a good knowledge of the Java. There are lots of resources on the web for learning Java and you can do it all in the Eclipse environment if you wish.
Good luck!

Categories