Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,407 members, 7,954,617 topics. Date: Saturday, 21 September 2024 at 01:34 AM |
Nairaland Forum / Science/Technology / Programming / Android App Programming! (2446 Views)
My New Complete English Classic Android App / Learn Android App Development For FREE Here / Pictures Of My First Android App (comments And Suggestion Needed) (2) (3) (4)
Android App Programming! by abubaka101: 5:14pm On Nov 13, 2013 |
It's been a while. Am still trying to get myself acquainted with the Android platform, via Android programming apps... So am asking experienced programmers in the house to share interesting beginner apps, that one can do to familiarize one's self wit the Android platform... Your suggestions are most welcome! Thanks |
Re: Android App Programming! by Nobody: 1:33am On Nov 16, 2013 |
I'm just few days old in Android, so this might have an obvious answer for experienced android programmers, but I can't seem to figure it out. The structure of the code snippet below is to add a Fragment to an Activity declaratively.Each time i run the code on my IDE using Genymotion as my android emulator, the program crashes. Below is the code: package com.example.dialog; import android.os.Bundle; import android.annotation.SuppressLint; import android.app.Activity; import android.view.Menu; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.DialogInterface; import android.view.View; import android.widget.Toast; @SuppressLint("NewApi" public class MainActivity extends Activity { static CharSequence[] items = { "Google", "Apple", "Microsoft" }; static boolean[] itemsChecked = new boolean [items.length]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void badAss(View v) { MyDialogFragment fragment= new MyDialogFragment(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.add(R.id.list, fragment); fragmentTransaction.commit(); } public static class MyDialogFragment extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setIcon(R.drawable.ic_launcher); builder.setTitle("This is a dialog with some simple text..." builder.setPositiveButton("OK",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(getActivity(),"OK clicked!", Toast.LENGTH_SHORT).show(); } } ); builder.setNegativeButton("Cancel",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(getActivity(),"Cancel clicked!", Toast.LENGTH_SHORT).show(); } } ); builder.setMultiChoiceItems(items, itemsChecked,new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog,int which, boolean isChecked) { Toast.makeText(getActivity(),items[which] + (isChecked ? " checked!":" unchecked!",Toast.LENGTH_SHORT).show(); } } ); return builder.create(); } } } with an XML layout as follows: <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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <fragment android:name="com.example.dialog.MainActivity$MyDialogFragment" android:id="@+id/list" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" /> <Button android:id="@id/my_logo" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/display" android:onClick="badAss" /> </LinearLayout> I have been stucked here for 2days trying to resolve the issue and it seems i cant exactly find what is wrong.Can anyone help out. Thanks 2 Likes |
Re: Android App Programming! by 5hyguy: 8:30am On Nov 16, 2013 |
Oga go learn html5 and phonegap, best 4 u dat way u can build for android, bb etc at d same tym |
Re: Android App Programming! by Jayclinics(m): 12:33pm On Nov 19, 2013 |
guy, I am learning xml so as to make it more simplier....u ve to start from the basis first: java programming fundamentals & xml 1 Like |
Re: Android App Programming! by abubaka101: 2:35pm On Nov 22, 2013 |
Tanks for your replies, but dis is not a "how to" thread. I knw/am still learning most/all u guys have said. What am asking for is: suggest Apps that a beginner can try to create for the Android platform, so as get himself "MORE familiar" with this platform... |
Re: Android App Programming! by prodam(m): 2:44pm On Nov 28, 2013 |
Check the mtn nextapp competition thread on this board. You gonna find lot of apps for the android platform developed by NL members. Or go to the store wap.mtnonlineplay.com/ |
Re: Android App Programming! by Nobody: 10:05am On Dec 02, 2013 |
crystal9t: I'm just few days old in Android, so this might have an obvious answer for experienced android programmers, but I can't seem to figure it out. The structure of the code snippet below is to add a Fragment to an Activity declaratively.Each time i run the code on my IDE using Genymotion as my android emulator, the program crashes. I'm new to android too. Your code seemed to be Ok, maybe u didn't declared it on your manifest.xml |
Re: Android App Programming! by Sundayademola(m): 11:50pm On Dec 04, 2013 |
crystal9t: I'm just few days old in Android, so this might have an obvious answer for experienced android programmers, but I can't seem to figure it out. The structure of the code snippet below is to add a Fragment to an Activity declaratively.Each time i run the code on my IDE using Genymotion as my android emulator, the program crashes.Can you post a screenshot of your logcat output,( The error output) |
Re: Android App Programming! by joefit4gur(m): 10:44am On Dec 10, 2013 |
When a app crashes, you check the LOGCAT, it will point you to the line number in your java code that's giving the error, usually something like Null pointer exception at com.packagename.classname.java and then a line number 90. yhu just check the classname of your package and check the line 90. App crashes due to errors, some minor as just forgetting to link in android manifest or in your xml layout build. |
Re: Android App Programming! by Deekaydadon(m): 3:50pm On Dec 14, 2013 |
Has anyone used a tecno android for debugging applications and what drivers did you install to make d device recognizable. I'm using a windows 8 PC and I'm stuck! |
(1) (Reply)
Www.buyvcc.com Is Scam He Is Big Thief In Nairaland / The Difference Between Java And Javascript / Top 10 Websites To Learn Coding Online
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 36 |