Android Studio Code Problem

fabulous
assignment.zip

res/mipmap-mdpi/ic_launcher_foreground.png

res/mipmap-mdpi/ic_launcher.png

res/mipmap-mdpi/ic_launcher_round.png

res/drawable-v24/ic_launcher_foreground.xml

res/mipmap-hdpi/ic_launcher_foreground.png

res/mipmap-hdpi/ic_launcher.png

res/mipmap-hdpi/ic_launcher_round.png

res/.DS_Store

__MACOSX/res/._.DS_Store

res/drawable/watch.jpg

res/drawable/headphones.jpg

res/drawable/icon.png

res/drawable/oculus.jpg

res/drawable/dji.jpg

res/drawable/kindle.png

res/drawable/ic_launcher_background.xml

res/mipmap-xxxhdpi/ic_launcher_foreground.png

res/mipmap-xxxhdpi/ic_launcher.png

res/mipmap-xxxhdpi/ic_launcher_round.png

res/layout/activity_main.xml

res/layout/activity_picture.xml

res/mipmap-xxhdpi/ic_launcher_foreground.png

res/mipmap-xxhdpi/ic_launcher.png

res/mipmap-xxhdpi/ic_launcher_round.png

res/values/colors.xml

#3F51B5 #303F9F #FF4081

res/values/dimens.xml

20sp 4dp 30dip 10dp 30sp 5dp

res/values/styles.xml

res/values/strings.xml

Tech Gadgets Apple Watch Oculus Sony WH-1000XM2 DJi PHANTOM 4PRO Kindle Paperwhite gadgets Picture Title View Web Page Apple Watch Oculus Sony WH-1000XM2 DJi PHANTOM 4PRO Kindle Paperwhite

res/mipmap-xhdpi/ic_launcher_foreground.png

res/mipmap-xhdpi/ic_launcher.png

res/mipmap-xhdpi/ic_launcher_round.png

res/mipmap-anydpi-v26/ic_launcher.xml

res/mipmap-anydpi-v26/ic_launcher_round.xml

ic_launcher-web.png

AndroidManifest.xml

java/com/example/zxh/techgadgets/Picture.java

java/com/example/zxh/techgadgets/Picture.java

package  com . example . zxh . techgadgets ;

import  android . content . Intent ;
import  android . support . v7 . app . AppCompatActivity ;
import  android . os . Bundle ;
import  android . widget . Button ;
import  android . widget . ImageView ;
import  android . widget . TextView ;

public   class   Picture   extends   AppCompatActivity   {
     public   static   final   String  ID_KEY  =   "RES_ID" ,  LBL_KEY  =   "LABEL" ,  URL_KEY = "URL" ;

    @ Override
     protected   void  onCreate ( Bundle  savedInstanceState )   {
         super . onCreate ( savedInstanceState );
        setContentView ( R . layout . activity_picture );

         Intent  intent  =  getIntent ();
         Bundle  extras  =  intent . getExtras ();

         if   ( extras  != null )
         {
             String  res_label  =  extras . getString ( LBL_KEY );
             final   TextView  picturTitle  =   ( TextView ) findViewById ( R . id . titleTextView );
            picturTitle . setText ( res_label );

             String  image_id  =  extras . getString ( ID_KEY );
             int  imageId  =   Integer . parseInt ( image_id );
             final   ImageView  picture  =   ( ImageView ) findViewById ( R . id . pictureImage );
            picture . setImageResource ( imageId );
            picture . setContentDescription ( res_label );

             String  url  =  extras . getString ( URL_KEY );
             final   Button  btnWeb  =   ( Button ) findViewById ( R . id . txtButton );

         }



     }
}

java/com/example/zxh/techgadgets/MainActivity.java

java/com/example/zxh/techgadgets/MainActivity.java

package  com . example . zxh . techgadgets ;

import  android . app . ListActivity ;
import  android . content . Intent ;
import  android . net . Uri ;
import  android . os . Bundle ;
import  android . view . View ;
import  android . widget . ArrayAdapter ;
import  android . widget . ListView ;
import  android . widget . Toast ;

import  java . util . Arrays ;
import  java . util . List ;

public   class   MainActivity   extends   ListActivity   {

    @ Override
     protected   void  onCreate ( Bundle  savedInstanceState )   {
         super . onCreate ( savedInstanceState );

         List < String >   Gadgets   =
                 Arrays . asList ( getResources (). getStringArray ( R . array . gadgets ));

        setListAdapter ( new   ArrayAdapter < String > ( this ,  R . layout . activity_main ,
                R . id . gadgets ,   Gadgets ));
     }

         protected   void  onListItemClick ( ListView  l ,   View  v ,   int  position ,   long  id )
         {
             Intent  intent ;

             switch   ( position )
             {
                 case   0 :
                    intent  =   new   Intent ( MainActivity . this ,   Picture . class );

                    intent . putExtra ( Picture . LBL_KEY ,
                            getResources (). getString ( R . string . txtWatch ));
                    intent . putExtra ( Picture . ID_KEY ,
                             Integer . toString ( R . drawable . watch ));



                     //intent = new Intent(Intent.ACTION_VIEW,
                       //      Uri.parse("https://www.apple.com/watch/"));
                     break ;
                 case   1 :
                    intent  =   new   Intent ( MainActivity . this ,   Picture . class );

                    intent . putExtra ( Picture . LBL_KEY ,
                            getResources (). getString ( R . string . txtOculus ));
                    intent . putExtra ( Picture . ID_KEY ,
                             Integer . toString ( R . drawable . oculus ));

                     //intent = new Intent(Intent.ACTION_VIEW,
                     //        Uri.parse("https://www.oculus.com"));
                     break ;
                 case   2 :
                    intent  =   new   Intent ( MainActivity . this ,   Picture . class );

                    intent . putExtra ( Picture . LBL_KEY ,
                            getResources (). getString ( R . string . txtHeadphone ));
                    intent . putExtra ( Picture . ID_KEY ,
                             Integer . toString ( R . drawable . headphones ));

                     //intent = new Intent(Intent.ACTION_VIEW,
                     //        Uri.parse("https://www.sony.com/electronics/headband-headphones/wh-1000xm2"));
                     break ;
                 case   3 :
                    intent  =   new   Intent ( MainActivity . this ,   Picture . class );

                    intent . putExtra ( Picture . LBL_KEY ,
                            getResources (). getString ( R . string . txtUVA ));
                    intent . putExtra ( Picture . ID_KEY ,
                             Integer . toString ( R . drawable . dji ));
                     //intent = new Intent(Intent.ACTION_VIEW,
                     //        Uri.parse("https://www.dji.com/phantom-4-pro?site=brandsite&from=landing_page"));
                     break ;

                 case   4 :
                    intent  =   new   Intent ( MainActivity . this ,   Picture . class );

                    intent . putExtra ( Picture . LBL_KEY ,
                            getResources (). getString ( R . string . txtKindle ));
                    intent . putExtra ( Picture . ID_KEY ,
                             Integer . toString ( R . drawable . kindle ));

                     //intent = new Intent(Intent.ACTION_VIEW,
                     //        Uri.parse("https://www.amazon.com/dp/B00OQVZDJM/ref=fs_ods_fs_eink_mt"));
                     break ;
                 default :
                     Toast  toast  =   Toast . makeText ( MainActivity . this ,
                             "Invaild Choice Made" ,   Toast . LENGTH_LONG );
                    toast . show ();
                    intent  =   null ;
             }

             if   ( intent  !=   null )
             {
                startActivity ( intent );
             }

         }

}